From dfe25d28341c3e7517b92b08f2cc80587fb4b90d Mon Sep 17 00:00:00 2001 From: gokareless Date: Sun, 6 Sep 2020 01:41:30 +0300 Subject: [PATCH 01/54] - Adjusted API to work with embedded arrays --- .../IsIterableContainingInAnyOrder.java | 11 ++++++-- .../IsIterableContainingInOrder.java | 5 ++++ .../test/java/org/hamcrest/MatchersTest.java | 28 +++++++++++++++++++ .../core/IsIterableContainingTest.java | 22 +++++++++++++++ 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 hamcrest/src/test/java/org/hamcrest/MatchersTest.java diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java index d6a9a33d..5756c278 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java @@ -124,10 +124,17 @@ public static Matcher> containsInAnyOrder(Matcher Matcher> containsInAnyOrder(T... items) { List> matchers = new ArrayList<>(); - for (T item : items) { + if (items.length == 1 && items[0].getClass().isArray()) { + @SuppressWarnings("unchecked") + T[] realItems = (T[]) items[0]; + for (T item : realItems) { matchers.add(equalTo(item)); + } + } else { + for (T item : items) { + matchers.add(equalTo(item)); + } } - return new IsIterableContainingInAnyOrder<>(matchers); } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java index ed62aa29..fb433df7 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java @@ -94,6 +94,11 @@ private void describeMismatch(Matcher matcher, F item) { */ @SafeVarargs public static Matcher> contains(E... items) { + if (items.length == 1 && items[0].getClass().isArray()) { + @SuppressWarnings("unchecked") + E[] realItems = (E[]) items[0]; + return contains(asEqualMatchers(realItems)); + } return contains(asEqualMatchers(items)); } diff --git a/hamcrest/src/test/java/org/hamcrest/MatchersTest.java b/hamcrest/src/test/java/org/hamcrest/MatchersTest.java new file mode 100644 index 00000000..e2395e6f --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/MatchersTest.java @@ -0,0 +1,28 @@ +package org.hamcrest; + +import java.util.Arrays; +import org.hamcrest.core.AnyOf; +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class MatchersTest { + + @Test + public void matchersContainsInAnyOrderCastTest() { + String[] truth = new String[] { "1", "2" }; + assertThat("doesn't contain elements", Arrays.asList("1", "2"), containsInAnyOrder(truth)); + Object otherTruth = truth; + assertThat("doesn't contain elements", Arrays.asList("1", "2"), containsInAnyOrder(otherTruth)); + } + + @Test + public void matchersContainsCastTest() { + String[] truth = new String[] { "1", "2" }; + assertThat("doesn't contain elements", Arrays.asList("1", "2"), contains(truth)); + Object otherTruth = truth; + assertThat("doesn't contain elements", Arrays.asList("1", "2"), contains(otherTruth)); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java index 02148b81..86787dfa 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java @@ -6,6 +6,7 @@ import org.junit.Test; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashSet; import java.util.Set; @@ -13,6 +14,8 @@ import static org.hamcrest.AbstractMatcherTest.*; import static org.hamcrest.core.IsIterableContaining.hasItem; import static org.hamcrest.core.IsIterableContaining.hasItems; +import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder; +import static org.hamcrest.collection.IsIterableContainingInOrder.contains; import static org.hamcrest.core.IsEqual.equalTo; public final class IsIterableContainingTest { @@ -86,6 +89,25 @@ public final class IsIterableContainingTest { matcher, asList(1, 2, 3)); } + @Test public void + isIterableContainingAnyOrderCast() { + String[] array = new String[]{"1", "2"}; + Object object = array; + Iterable real = Arrays.asList("1", "2"); + final Matcher> matcher = containsInAnyOrder(object); + assertTrue("does not match the same object", matcher.matches(real)); + } + + @Test + public void + isIterableContainingCast() { + String[] array = new String[]{"1", "2"}; + Object object = array; + Iterable real = Arrays.asList("1", "2"); + final Matcher> matcher = contains(object); + assertTrue("does not match the same object", matcher.matches(real)); + } + private static Matcher mismatchable(final String string) { return new TypeSafeDiagnosingMatcher() { @Override From f0e2d0e8351891e35d98dbf328d1c2a731cf1f6d Mon Sep 17 00:00:00 2001 From: Karl-Philipp Richter Date: Thu, 29 Mar 2018 17:45:41 +0200 Subject: [PATCH 02/54] exposed IsEqualCompressingWhiteSpace.string in protected getString in order to facilitate use in subclasses --- .../java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java b/hamcrest/src/main/java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java index 1bf266af..5618627e 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java +++ b/hamcrest/src/main/java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java @@ -21,6 +21,10 @@ public IsEqualCompressingWhiteSpace(String string) { this.string = string; } + protected String getString() { + return string; + } + @Override public boolean matchesSafely(String item) { return stripSpaces(string).equals(stripSpaces(item)); From f6abc8c1e1f148d99cf3e168eeb4b395acfebe24 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 15:53:46 +0000 Subject: [PATCH 03/54] JavaDoc only @param org.hamcrest.beans --- hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java | 2 ++ .../main/java/org/hamcrest/beans/HasPropertyWithValue.java | 4 ++++ hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java | 4 ++++ .../main/java/org/hamcrest/beans/SamePropertyValuesAs.java | 2 ++ 4 files changed, 12 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java b/hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java index 3a7cfe65..07181c2a 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java @@ -46,6 +46,8 @@ public void describeTo(Description description) { * For example: *
assertThat(myBean, hasProperty("foo"))
* + * @param + * the matcher type. * @param propertyName * the name of the JavaBean property that examined beans should possess * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java b/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java index 1bf81dec..e4aca0dd 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java @@ -155,6 +155,8 @@ public Condition apply(PropertyDescriptor property, Description mismatch * For example: *
assertThat(myBean, hasProperty("foo", equalTo("bar"))
* + * @param + * the matcher type. * @param propertyName * the name of the JavaBean property that examined beans should possess * @param valueMatcher @@ -173,6 +175,8 @@ public static Matcher hasProperty(String propertyName, Matcher valueMa * For example: *
assertThat(myBean, hasProperty("foo.bar.baz", equalTo("a property value"))
* + * @param + * the matcher type. * @param path * the dot-separated path from the examined object to the JavaBean property * @param valueMatcher diff --git a/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java b/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java index d1564653..99f933ea 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java @@ -18,6 +18,10 @@ public class PropertyUtil { * Returns the description of the property with the provided * name on the provided object's interface. * + * @param propertyName + * the bean property name. + * @param fromObj + * the object to check. * @return the descriptor of the property, or null if the property does not exist. * @throws IllegalArgumentException if there's a introspection failure */ diff --git a/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java b/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java index c36203f7..ab723d86 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java @@ -147,6 +147,8 @@ private static Object readProperty(Method method, Object target) { *
assertThat(myBean, samePropertyValuesAs(myExpectedBean))
*
assertThat(myBean, samePropertyValuesAs(myExpectedBean), "age", "height")
* + * @param + * the matcher type. * @param expectedBean * the bean against which examined beans are compared * @param ignoredProperties From 934dd7fee9015c2f3567343156a45a5357228175 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 15:54:02 +0000 Subject: [PATCH 04/54] JavaDoc only @param org.hamcrest.collection --- .../org/hamcrest/collection/ArrayMatching.java | 16 ++++++++++++++++ .../java/org/hamcrest/collection/IsArray.java | 2 ++ .../collection/IsArrayContainingInAnyOrder.java | 9 ++++++--- .../collection/IsArrayContainingInOrder.java | 9 ++++++--- .../org/hamcrest/collection/IsArrayWithSize.java | 7 ++++++- .../collection/IsCollectionWithSize.java | 4 ++++ .../hamcrest/collection/IsEmptyCollection.java | 4 ++++ .../org/hamcrest/collection/IsEmptyIterable.java | 4 ++++ .../main/java/org/hamcrest/collection/IsIn.java | 15 ++++++++++++--- .../IsIterableContainingInAnyOrder.java | 6 ++++++ .../collection/IsIterableContainingInOrder.java | 8 ++++++++ .../IsIterableContainingInRelativeOrder.java | 6 ++++++ .../hamcrest/collection/IsIterableWithSize.java | 4 ++++ .../org/hamcrest/collection/IsMapContaining.java | 16 ++++++++++++++++ .../org/hamcrest/collection/IsMapWithSize.java | 12 ++++++++++++ 15 files changed, 112 insertions(+), 10 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java b/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java index d6adc224..59811ff1 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java @@ -24,6 +24,8 @@ public class ArrayMatching { * For example: *
assertThat(new String[] {"foo", "bar"}, hasItemInArray(startsWith("ba")))
* + * @param + * the matcher type. * @param elementMatcher * the matcher to apply to elements in examined arrays * @return The matcher. @@ -39,6 +41,8 @@ public static Matcher hasItemInArray(Matcher elementMatcher) * instead of: *
assertThat(hasItemInArray(equalTo(x)))
* + * @param + * the matcher type. * @param element * the element that should be present in examined arrays * @return The matcher. @@ -64,6 +68,8 @@ public static Matcher hasItemInArray(T element) { *

*
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
* + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by an entry in an examined array * @return The matcher. @@ -90,6 +96,8 @@ public static Matcher arrayContainingInAnyOrder(Matcher... i *

*
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
* + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by an item provided by an examined array * @return The matcher. @@ -113,6 +121,8 @@ public static Matcher arrayContainingInAnyOrder(Collection *
assertThat(new String[]{"foo", "bar"}, containsInAnyOrder("bar", "foo"))
* + * @param + * the matcher type. * @param items * the items that must equal the entries of an examined array, in any order * @return The matcher. @@ -129,6 +139,8 @@ public static Matcher arrayContainingInAnyOrder(E... items) { * For example: *
assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))
* + * @param + * the matcher type. * @param items * the items that must equal the items within an examined array * @return The matcher. @@ -144,6 +156,8 @@ public static Matcher arrayContaining(E... items) { * For example: *
assertThat(new String[]{"foo", "bar"}, arrayContaining(equalTo("foo"), equalTo("bar")))
* + * @param + * the matcher type. * @param itemMatchers * the matchers that must be satisfied by the items in the examined array * @return The matcher. @@ -164,6 +178,8 @@ public static Matcher arrayContaining(Matcher... itemMatcher * For example: *
assertThat(new String[]{"foo", "bar"}, arrayContaining(Arrays.asList(equalTo("foo"), equalTo("bar"))))
* + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by the corresponding item in an examined array * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java index 22fef90a..4e7a1230 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java @@ -93,6 +93,8 @@ protected String descriptionEnd() { * For example: *
assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))
* + * @param + * the matcher type. * @param elementMatchers * the matchers that the elements of examined arrays should satisfy * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java index 3157bcce..162156b4 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java @@ -54,7 +54,8 @@ public void describeTo(Description description) { *
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
* * @deprecated As of version 2.1, use {@link ArrayMatching#arrayContainingInAnyOrder(Matcher[])}. - * + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by an entry in an examined array * @return The matcher. @@ -77,7 +78,8 @@ public static Matcher arrayContainingInAnyOrder(Matcher... i *
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
* * @deprecated As of version 2.1, use {@link ArrayMatching#arrayContainingInAnyOrder(Collection)}. - * + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by an item provided by an examined array * @return The matcher. @@ -100,7 +102,8 @@ public static Matcher arrayContainingInAnyOrder(CollectionassertThat(new String[]{"foo", "bar"}, containsInAnyOrder("bar", "foo")) * * @deprecated As of version 2.1, use {@link ArrayMatching#arrayContainingInAnyOrder(Object[])}. - * + * @param + * the matcher type. * @param items * the items that must equal the entries of an examined array, in any order * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java index e26cc462..6e46d472 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java @@ -47,7 +47,8 @@ public void describeTo(Description description) { *
assertThat(new String[]{"foo", "bar"}, contains("foo", "bar"))
* * @deprecated As of version 2.1, use {@link ArrayMatching#arrayContaining(Object[])}. - * + * @param + * the matcher type. * @param items * the items that must equal the items within an examined array * @return The matcher. @@ -69,7 +70,8 @@ public static Matcher arrayContaining(E... items) { *
assertThat(new String[]{"foo", "bar"}, contains(equalTo("foo"), equalTo("bar")))
* * @deprecated As of version 2.1, use {@link ArrayMatching#arrayContaining(Matcher[])}. - * + * @param + * the matcher type. * @param itemMatchers * the matchers that must be satisfied by the items in the examined array * @return The matcher. @@ -87,7 +89,8 @@ public static Matcher arrayContaining(Matcher... itemMatcher *
assertThat(new String[]{"foo", "bar"}, contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
* * @deprecated As of version 2.1, use {@link ArrayMatching#arrayContaining(List)}. - * + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by the corresponding item in an examined array * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java index d779691f..b4441437 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java @@ -24,7 +24,8 @@ protected Integer featureValueOf(E[] actual) { * satisfies the specified matcher. * For example: *
assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))
- * + * @param + * the matcher type. * @param sizeMatcher * a matcher for the length of an examined array * @return The matcher. @@ -39,6 +40,8 @@ public static Matcher arrayWithSize(Matcher sizeMatche * For example: *
assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))
* + * @param + * the matcher type. * @param size * the length that an examined array must have for a positive match * @return The matcher. @@ -53,6 +56,8 @@ public static Matcher arrayWithSize(int size) { * For example: *
assertThat(new String[0], emptyArray())
* + * @param + * the matcher type. * @return The matcher. */ public static Matcher emptyArray() { diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java index 8ff37131..2143046c 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java @@ -26,6 +26,8 @@ protected Integer featureValueOf(Collection actual) { * For example: *
assertThat(Arrays.asList("foo", "bar"), hasSize(equalTo(2)))
* + * @param + * the matcher type. * @param sizeMatcher * a matcher for the size of an examined {@link java.util.Collection} * @return The matcher. @@ -40,6 +42,8 @@ public static Matcher> hasSize(MatcherassertThat(Arrays.asList("foo", "bar"), hasSize(2)) * + * @param + * the matcher type. * @param size * the expected size of an examined {@link java.util.Collection} * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java index c48b80e5..7a07360a 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java @@ -32,6 +32,8 @@ public void describeTo(Description description) { * For example: *
assertThat(new ArrayList<String>(), is(empty()))
* + * @param + * the matcher type. * @return The matcher. */ public static Matcher> empty() { @@ -44,6 +46,8 @@ public static Matcher> empty() { * For example: *
assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
* + * @param + * the matcher type. * @param unusedToForceReturnType * the type of the collection's content * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java index fc1f5a3d..4173ac3a 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java @@ -28,6 +28,8 @@ public void describeTo(Description description) { * For example: *
assertThat(new ArrayList<String>(), is(emptyIterable()))
* + * @param + * the matcher type. * @return The matcher. */ public static Matcher> emptyIterable() { @@ -39,6 +41,8 @@ public static Matcher> emptyIterable() { * For example: *
assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
* + * @param + * the matcher type. * @param unusedToForceReturnType * the type of the iterable's content * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java index b9b74571..0a259149 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java @@ -37,7 +37,8 @@ public void describeTo(Description buffer) { *
assertThat("foo", isIn(Arrays.asList("bar", "foo")))
* * @deprecated use is(in(...)) instead - * + * @param + * the matcher type. * @param collection * the collection in which matching items must be found * @return The matcher. @@ -53,6 +54,8 @@ public static Matcher isIn(Collection collection) { * For example: *
assertThat("foo", is(in(Arrays.asList("bar", "foo"))))
* + * @param + * the matcher type. * @param collection * the collection in which matching items must be found * @return The matcher. @@ -68,7 +71,8 @@ public static Matcher in(Collection collection) { *
assertThat("foo", isIn(new String[]{"bar", "foo"}))
* * @deprecated use is(in(...)) instead - * + * @param + * the matcher type. * @param elements * the array in which matching items must be found * @return The matcher. @@ -84,6 +88,8 @@ public static Matcher isIn(T[] elements) { * For example: *
assertThat("foo", is(in(new String[]{"bar", "foo"})))
* + * @param + * the matcher type. * @param elements * the array in which matching items must be found * @return The matcher. @@ -99,7 +105,8 @@ public static Matcher in(T[] elements) { *
assertThat("foo", isOneOf("bar", "foo"))
* * @deprecated use is(oneOf(...)) instead - * + * @param + * the matcher type. * @param elements * the elements amongst which matching items will be found * @return The matcher. @@ -116,6 +123,8 @@ public static Matcher isOneOf(T... elements) { * For example: *
assertThat("foo", is(oneOf("bar", "foo")))
* + * @param + * the matcher type. * @param elements * the elements amongst which matching items will be found * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java index daaf9277..975e44df 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java @@ -93,6 +93,8 @@ private boolean isMatched(S item) { *

*
assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(equalTo("bar"), equalTo("foo")))
* + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by an item provided by an examined {@link Iterable} * @return The matcher. @@ -119,6 +121,8 @@ public static Matcher> containsInAnyOrder(Matcher *
assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))
* + * @param + * the matcher type. * @param items * the items that must equal the items provided by an examined {@link Iterable} in any order * @return The matcher. @@ -148,6 +152,8 @@ public static Matcher> containsInAnyOrder(T... items) *

For example:

*
assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
* + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by an item provided by an examined {@link Iterable} * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java index 5f30d379..d7736c11 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java @@ -89,6 +89,8 @@ private void describeMismatch(Matcher matcher, F item) { * For example: *
assertThat(Arrays.asList("foo", "bar"), contains("foo", "bar"))
* + * @param + * the matcher type. * @param items * the items that must equal the items provided by an examined {@link Iterable} * @return The matcher. @@ -105,6 +107,8 @@ public static Matcher> contains(E... items) { * For example: *
assertThat(Arrays.asList("foo"), contains(equalTo("foo")))
* + * @param + * the matcher type. * @param itemMatcher * the matcher that must be satisfied by the single item provided by an * examined {@link Iterable} @@ -123,6 +127,8 @@ public static Matcher> contains(final MatcherassertThat(Arrays.asList("foo", "bar"), contains(equalTo("foo"), equalTo("bar"))) * + * @param + * the matcher type. * @param itemMatchers * the matchers that must be satisfied by the items provided by an examined {@link Iterable} * @return The matcher. @@ -143,6 +149,8 @@ public static Matcher> contains(Matcher... * For example: *
assertThat(Arrays.asList("foo", "bar"), contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
* + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by the corresponding item provided by * an examined {@link Iterable} diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java index 9a505516..7ed7f2e2 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java @@ -74,6 +74,8 @@ public boolean isFinished() { * For example: *
assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder("b", "d"))
* + * @param + * the matcher type. * @param items * the items that must be contained within items provided by an examined {@link Iterable} in the same relative order * @return The matcher. @@ -95,6 +97,8 @@ public static Matcher> containsInRelativeOrder(E... it * For example: *
assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder(equalTo("b"), equalTo("d")))
* + * @param + * the matcher type. * @param itemMatchers * the matchers that must be satisfied by the items provided by an examined {@link Iterable} in the same relative order * @return The matcher. @@ -111,6 +115,8 @@ public static Matcher> containsInRelativeOrder(Matcher * For example: *
assertThat(Arrays.asList("a", "b", "c", "d", "e"), contains(Arrays.asList(equalTo("b"), equalTo("d"))))
* + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by the items provided by * an examined {@link Iterable} in the same relative order diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java index 9d2a69c9..95d53b4f 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java @@ -30,6 +30,8 @@ protected Integer featureValueOf(Iterable actual) { * For example: *
assertThat(Arrays.asList("foo", "bar"), iterableWithSize(equalTo(2)))
* + * @param + * the matcher type. * @param sizeMatcher * a matcher for the number of items that should be yielded by an examined {@link Iterable} * @return The matcher. @@ -45,6 +47,8 @@ public static Matcher> iterableWithSize(Matcher * For example: *
assertThat(Arrays.asList("foo", "bar"), iterableWithSize(2))
* + * @param + * the matcher type. * @param size * the number of items that should be yielded by an examined {@link Iterable} * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java b/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java index 130e69c6..ac9d473f 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java @@ -50,6 +50,10 @@ public void describeTo(Description description) { * For example: *
assertThat(myMap, hasEntry(equalTo("bar"), equalTo("foo")))
* + * @param + * the map key type. + * @param + * the map value type. * @param keyMatcher * the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entry * @param valueMatcher @@ -67,6 +71,10 @@ public static Matcher> hasEntry(MatcherassertThat(myMap, hasEntry("bar", "foo")) * + * @param + * the map key type. + * @param + * the map value type. * @param key * the key that, in combination with the value, must be describe at least one entry * @param value @@ -83,6 +91,8 @@ public static Matcher> hasEntry(K key, V valu * For example: *
assertThat(myMap, hasKey(equalTo("bar")))
* + * @param + * the map key type. * @param keyMatcher * the matcher that must be satisfied by at least one key * @return The matcher. @@ -97,6 +107,8 @@ public static Matcher> hasEntry(K key, V valu * For example: *
assertThat(myMap, hasKey("bar"))
* + * @param + * the map key type. * @param key * the key that satisfying maps must contain * @return The matcher. @@ -111,6 +123,8 @@ public static Matcher> hasEntry(K key, V valu * For example: *
assertThat(myMap, hasValue(equalTo("foo")))
* + * @param + * the value type. * @param valueMatcher * the matcher that must be satisfied by at least one value * @return The matcher. @@ -125,6 +139,8 @@ public static Matcher> hasEntry(K key, V valu * For example: *
assertThat(myMap, hasValue("foo"))
* + * @param + * the value type. * @param value * the value that satisfying maps must contain * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java index ed5172a7..9821d720 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java @@ -27,6 +27,10 @@ protected Integer featureValueOf(Map actual) { * For example: *
assertThat(myMap, is(aMapWithSize(equalTo(2))))
* + * @param + * the map key type. + * @param + * the map value type. * @param sizeMatcher * a matcher for the size of an examined {@link java.util.Map} * @return The matcher. @@ -41,6 +45,10 @@ protected Integer featureValueOf(Map actual) { * For example: *
assertThat(myMap, is(aMapWithSize(2)))
* + * @param + * the map key type. + * @param + * the map value type. * @param size * the expected size of an examined {@link java.util.Map} * @return The matcher. @@ -55,6 +63,10 @@ protected Integer featureValueOf(Map actual) { * For example: *
assertThat(myMap, is(anEmptyMap()))
* + * @param + * the map key type. + * @param + * the map value type. * @return The matcher. */ public static Matcher> anEmptyMap() { From 95cf0b2c990d8776c9e92445348b5bc082e1c27c Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 15:54:19 +0000 Subject: [PATCH 05/54] JavaDoc only @param org.hamcrest.comparator --- .../org/hamcrest/comparator/ComparatorMatcherBuilder.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java b/hamcrest/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java index 0627d364..13a0db64 100644 --- a/hamcrest/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java +++ b/hamcrest/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java @@ -18,6 +18,8 @@ public final class ComparatorMatcherBuilder { * For example: *
assertThat(1, ComparatorMatcherBuilder.<Integer>usingNaturalOrdering().lessThanOrEqualTo(1))
* + * @param + * the matcher type. * @return The matcher. */ public static > ComparatorMatcherBuilder usingNaturalOrdering() { @@ -38,6 +40,10 @@ public int compare(T o1, T o2) { * } * }).lessThan(4)) * + * @param + * the matcher type. + * @param comparator + * the comparator for the matcher to use. * @return The matcher. */ public static ComparatorMatcherBuilder comparedBy(Comparator comparator) { From ebb9be25b035cb14984d78a8c5332e4fc8d550d8 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 15:54:29 +0000 Subject: [PATCH 06/54] JavaDoc only @param org.hamcrest.core --- hamcrest/src/main/java/org/hamcrest/core/AllOf.java | 8 ++++++++ hamcrest/src/main/java/org/hamcrest/core/AnyOf.java | 8 ++++++++ .../java/org/hamcrest/core/CombinableMatcher.java | 13 +++++++++++++ .../main/java/org/hamcrest/core/DescribedAs.java | 4 +++- hamcrest/src/main/java/org/hamcrest/core/Every.java | 2 ++ hamcrest/src/main/java/org/hamcrest/core/Is.java | 12 ++++++++++++ .../org/hamcrest/core/IsCollectionContaining.java | 11 ++++++++--- .../src/main/java/org/hamcrest/core/IsEqual.java | 6 ++++++ .../main/java/org/hamcrest/core/IsInstanceOf.java | 8 ++++++++ .../org/hamcrest/core/IsIterableContaining.java | 8 ++++++++ hamcrest/src/main/java/org/hamcrest/core/IsNot.java | 4 ++++ .../src/main/java/org/hamcrest/core/IsNull.java | 4 ++++ .../src/main/java/org/hamcrest/core/IsSame.java | 4 ++++ 13 files changed, 88 insertions(+), 4 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/core/AllOf.java b/hamcrest/src/main/java/org/hamcrest/core/AllOf.java index b21165a4..ff65f263 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/AllOf.java +++ b/hamcrest/src/main/java/org/hamcrest/core/AllOf.java @@ -45,6 +45,10 @@ public void describeTo(Description description) { * For example: *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
* + * @param + * the matcher type. + * @param matchers + * all the matchers must pass. * @return The matcher. */ public static Matcher allOf(Iterable> matchers) { @@ -56,6 +60,10 @@ public static Matcher allOf(Iterable> matchers) { * For example: *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
* + * @param + * the matcher type. + * @param matchers + * all the matchers must pass. * @return The matcher. */ @SafeVarargs diff --git a/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java b/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java index c282cd85..116f63a8 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java +++ b/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java @@ -35,6 +35,10 @@ public void describeTo(Description description) { * For example: *
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
* + * @param + * the matcher type. + * @param matchers + * any the matchers must pass. * @return The matcher. */ public static AnyOf anyOf(Iterable> matchers) { @@ -46,6 +50,10 @@ public static AnyOf anyOf(Iterable> matchers) { * For example: *
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
* + * @param + * the matcher type. + * @param matchers + * any the matchers must pass. * @return The matcher. */ @SafeVarargs diff --git a/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java b/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java index 97fbb634..f90e7d55 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java @@ -6,6 +6,11 @@ import java.util.ArrayList; +/** + * TODO: Finish Class Level Documentation. + * + * @param the type of matcher being combined. + */ public class CombinableMatcher extends TypeSafeDiagnosingMatcher { private final Matcher matcher; @@ -47,6 +52,10 @@ private ArrayList> templatedListWith(Matcher other * For example: *
assertThat("fab", both(containsString("a")).and(containsString("b")))
* + * @param + * the matcher type. + * @param matcher + * the matcher to combine, and both must pass. * @return The matcher. */ public static CombinableBothMatcher both(Matcher matcher) { @@ -68,6 +77,10 @@ public CombinableMatcher and(Matcher other) { * For example: *
assertThat("fan", either(containsString("a")).or(containsString("b")))
* + * @param + * the matcher type. + * @param matcher + * the matcher to combine, and either must pass. * @return The matcher. */ public static CombinableEitherMatcher either(Matcher matcher) { diff --git a/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java b/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java index 4b95713b..1bcb4c89 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java +++ b/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java @@ -54,8 +54,10 @@ 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())
+ *
describedAs("a big decimal equal to %0", equalTo(myBigDecimal), myBigDecimal.toPlainString())
* + * @param + * the matcher type. * @param description * the new description for the wrapped matcher * @param matcher diff --git a/hamcrest/src/main/java/org/hamcrest/core/Every.java b/hamcrest/src/main/java/org/hamcrest/core/Every.java index cf4fed6d..b7099a71 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/Every.java +++ b/hamcrest/src/main/java/org/hamcrest/core/Every.java @@ -35,6 +35,8 @@ public void describeTo(Description description) { * For example: *
assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
* + * @param + * the matcher type. * @param itemMatcher * the matcher to apply to every item provided by the examined {@link Iterable} * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/core/Is.java b/hamcrest/src/main/java/org/hamcrest/core/Is.java index ffbfd7a7..5f5716dc 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/Is.java +++ b/hamcrest/src/main/java/org/hamcrest/core/Is.java @@ -43,6 +43,10 @@ public void describeMismatch(Object item, Description mismatchDescription) { * instead of: *
assertThat(cheese, equalTo(smelly))
* + * @param + * the matcher type. + * @param matcher + * the matcher to wrap. * @return The matcher. */ public static Matcher is(Matcher matcher) { @@ -56,6 +60,10 @@ public static Matcher is(Matcher matcher) { * instead of: *
assertThat(cheese, is(equalTo(smelly)))
* + * @param + * the matcher type. + * @param value + * the value to check. * @return The matcher. */ public static Matcher is(T value) { @@ -69,6 +77,10 @@ public static Matcher is(T value) { * instead of: *
assertThat(cheese, is(instanceOf(Cheddar.class)))
* + * @param + * the matcher type. + * @param type + * the type to check. * @return The matcher. */ public static Matcher isA(Class type) { diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java b/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java index 0ca8bf65..348ae054 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java @@ -36,6 +36,8 @@ public void describeTo(Description description) { * * @deprecated As of version 2.1, use {@link IsIterableContaining#hasItem(Matcher)}. * + * @param + * the matcher type. * @param itemMatcher * the matcher to apply to items provided by the examined {@link Iterable} * @return The matcher. @@ -53,7 +55,8 @@ public static Matcher> hasItem(Matcher itemMa *
assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
* * @deprecated As of version 2.1, use {@link IsIterableContaining#hasItem(Object)}. - * + * @param + * the matcher type. * @param item * the item to compare against the items provided by the examined {@link Iterable} * @return The matcher. @@ -72,7 +75,8 @@ public static Matcher> hasItem(T item) { *
assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
* * @deprecated As of version 2.1, use {@link IsIterableContaining#hasItems(Matcher[])}}. - * + * @param + * the matcher type. * @param itemMatchers * the matchers to apply to items provided by the examined {@link Iterable} * @return The matcher. @@ -91,7 +95,8 @@ public static Matcher> hasItems(Matcher... itemMatche *
assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
* * @deprecated As of version 2.1, use {@link IsIterableContaining#hasItems(Object[])}}. - * + * @param + * the matcher type. * @param items * the items to compare against the items provided by the examined {@link Iterable} * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java b/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java index 868d1215..5b90edca 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java @@ -82,6 +82,10 @@ private static boolean isArray(Object o) { * assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"})); * * + * @param + * the matcher type. + * @param operand + * the value to check. * @return The matcher. */ public static Matcher equalTo(T operand) { @@ -92,6 +96,8 @@ public static Matcher equalTo(T operand) { * Creates an {@link org.hamcrest.core.IsEqual} matcher that does not enforce the values being * compared to be of the same static type. * + * @param operand + * the value to check. * @return The matcher. */ public static Matcher equalToObject(Object operand) { diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java b/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java index 1cd202c8..c0d366e6 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java @@ -65,6 +65,10 @@ public void describeTo(Description description) { * For example: *
assertThat(new Canoe(), instanceOf(Paddlable.class));
* + * @param + * the matcher type. + * @param type + * the type to check. * @return The matcher. */ @SuppressWarnings("unchecked") @@ -83,6 +87,10 @@ public static Matcher instanceOf(Class type) { * For example: *
assertThat(new Canoe(), instanceOf(Canoe.class));
* + * @param + * the matcher type. + * @param type + * the type to check. * @return The matcher. */ @SuppressWarnings("unchecked") diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java b/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java index 67016899..13104fea 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java @@ -63,6 +63,8 @@ public void describeTo(Description description) { * For example: *
assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
* + * @param + * the matcher type. * @param itemMatcher * the matcher to apply to items provided by the examined {@link Iterable} * @return The matcher. @@ -79,6 +81,8 @@ public static Matcher> hasItem(Matcher itemMa * For example: *
assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
* + * @param + * the matcher type. * @param item * the item to compare against the items provided by the examined {@link Iterable} * @return The matcher. @@ -96,6 +100,8 @@ public static Matcher> hasItem(T item) { * For example: *
assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
* + * @param + * the matcher type. * @param itemMatchers * the matchers to apply to items provided by the examined {@link Iterable} * @return The matcher. @@ -120,6 +126,8 @@ public static Matcher> hasItems(Matcher... itemMatche * For example: *
assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
* + * @param + * the matcher type. * @param items * the items to compare against the items provided by the examined {@link Iterable} * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsNot.java b/hamcrest/src/main/java/org/hamcrest/core/IsNot.java index 6db38bef..4973e377 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsNot.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsNot.java @@ -34,6 +34,8 @@ public void describeTo(Description description) { * For example: *
assertThat(cheese, is(not(equalTo(smelly))))
* + * @param + * the matcher type. * @param matcher * the matcher whose sense should be inverted * @return The matcher. @@ -49,6 +51,8 @@ public static Matcher not(Matcher matcher) { * instead of: *
assertThat(cheese, is(not(equalTo(smelly))))
* + * @param + * the matcher type. * @param value * the value that any examined object should not equal * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsNull.java b/hamcrest/src/main/java/org/hamcrest/core/IsNull.java index 328daffa..71a82abb 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsNull.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsNull.java @@ -50,6 +50,8 @@ public static Matcher notNullValue() { * For example: *
assertThat(cheese, is(nullValue(Cheese.class))
* + * @param + * the matcher type. * @param type * dummy parameter used to infer the generic type of the returned matcher * @return The matcher. @@ -66,6 +68,8 @@ public static Matcher nullValue(Class type) { * instead of: *
assertThat(cheese, is(not(nullValue(X.class))))
* + * @param + * the matcher type. * @param type * dummy parameter used to infer the generic type of the returned matcher * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsSame.java b/hamcrest/src/main/java/org/hamcrest/core/IsSame.java index da39f91a..7c4e3685 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsSame.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsSame.java @@ -31,6 +31,8 @@ public void describeTo(Description description) { * Creates a matcher that matches only when the examined object is the same instance as * the specified target object. * + * @param + * the matcher type. * @param target * the target instance against which others should be assessed * @return The matcher. @@ -43,6 +45,8 @@ public static Matcher sameInstance(T target) { * Creates a matcher that matches only when the examined object is the same instance as * the specified target object. * + * @param + * the matcher type. * @param target * the target instance against which others should be assessed * @return The matcher. From a393ed9966d87bc3639d3282ed2e41afd3f2d11b Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 15:54:39 +0000 Subject: [PATCH 07/54] JavaDoc only @param org.hamcrest.object --- hamcrest/src/main/java/org/hamcrest/object/HasToString.java | 4 ++++ .../src/main/java/org/hamcrest/object/IsCompatibleType.java | 2 ++ 2 files changed, 6 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/object/HasToString.java b/hamcrest/src/main/java/org/hamcrest/object/HasToString.java index e807674f..778faa54 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/HasToString.java +++ b/hamcrest/src/main/java/org/hamcrest/object/HasToString.java @@ -21,6 +21,8 @@ protected String featureValueOf(T actual) { * For example: *
assertThat(true, hasToString(equalTo("TRUE")))
* + * @param + * the matcher type. * @param toStringMatcher * the matcher used to verify the toString result * @return The matcher. @@ -35,6 +37,8 @@ public static Matcher hasToString(Matcher toStringMatcher * For example: *
assertThat(true, hasToString("TRUE"))
* + * @param + * the matcher type. * @param expectedToString * the expected toString result * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java b/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java index 388f1187..67793b3f 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java +++ b/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java @@ -32,6 +32,8 @@ public void describeTo(Description description) { * For example: *
assertThat(Integer.class, typeCompatibleWith(Number.class))
* + * @param + * the matcher type. * @param baseType * the base class to examine classes against * @return The matcher. From 877f76a7d8610b28a7a45a748caa225bd363b516 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 16:09:50 +0000 Subject: [PATCH 08/54] JavaDoc only @param org.hamcrest.number --- .../java/org/hamcrest/number/OrderingComparison.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/number/OrderingComparison.java b/hamcrest/src/main/java/org/hamcrest/number/OrderingComparison.java index f5f98150..42493140 100644 --- a/hamcrest/src/main/java/org/hamcrest/number/OrderingComparison.java +++ b/hamcrest/src/main/java/org/hamcrest/number/OrderingComparison.java @@ -15,6 +15,8 @@ private OrderingComparison() { * For example: *
assertThat(1, comparesEqualTo(1))
* + * @param + * the matcher type. * @param value the value which, when passed to the compareTo method of the examined object, should return zero * @return The matcher. */ @@ -29,6 +31,8 @@ public static > Matcher comparesEqualTo(T value) { * For example: *
assertThat(2, greaterThan(1))
* + * @param + * the matcher type. * @param value the value which, when passed to the compareTo method of the examined object, should return greater * than zero * @return The matcher. @@ -44,6 +48,8 @@ public static > Matcher greaterThan(T value) { * For example: *
assertThat(1, greaterThanOrEqualTo(1))
* + * @param + * the matcher type. * @param value the value which, when passed to the compareTo method of the examined object, should return greater * than or equal to zero * @return The matcher. @@ -59,6 +65,8 @@ public static > Matcher greaterThanOrEqualTo(T value) * For example: *
assertThat(1, lessThan(2))
* + * @param + * the matcher type. * @param value the value which, when passed to the compareTo method of the examined object, should return less * than zero * @return The matcher. @@ -74,6 +82,8 @@ public static > Matcher lessThan(T value) { * For example: *
assertThat(1, lessThanOrEqualTo(1))
* + * @param + * the matcher type. * @param value the value which, when passed to the compareTo method of the examined object, should return less * than or equal to zero * @return The matcher. From facac84a51b08c4b64acb9730a56f414ae2bc01e Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 17:28:13 +0000 Subject: [PATCH 09/54] JavaDoc only @param org.hamcrest.text --- hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java b/hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java index 53462953..a54a793d 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java +++ b/hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java @@ -27,6 +27,8 @@ public void describeTo(Description description) { * Creates a matcher of {@link java.lang.String} that matches when the examined string * exactly matches the given {@link java.util.regex.Pattern}. * + * @param pattern + * the text pattern to match. * @return The matcher. */ public static Matcher matchesPattern(Pattern pattern) { @@ -37,6 +39,8 @@ public static Matcher matchesPattern(Pattern 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}. * + * @param regex + * the regex to match. * @return The matcher. */ public static Matcher matchesPattern(String regex) { From 450e792832cd612b22a5dfca6a7ebe21f424f0d5 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 15:54:47 +0000 Subject: [PATCH 10/54] JavaDoc only @param org.hamcrest --- .../java/org/hamcrest/BaseDescription.java | 8 +- .../main/java/org/hamcrest/CoreMatchers.java | 101 ++++- .../main/java/org/hamcrest/Description.java | 35 +- .../java/org/hamcrest/DiagnosingMatcher.java | 2 +- .../src/main/java/org/hamcrest/Matchers.java | 424 +++++++++++++++--- .../java/org/hamcrest/StringDescription.java | 4 +- .../hamcrest/TypeSafeDiagnosingMatcher.java | 9 +- .../java/org/hamcrest/TypeSafeMatcher.java | 15 +- 8 files changed, 513 insertions(+), 85 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/BaseDescription.java b/hamcrest/src/main/java/org/hamcrest/BaseDescription.java index d0c8fc41..10a96969 100644 --- a/hamcrest/src/main/java/org/hamcrest/BaseDescription.java +++ b/hamcrest/src/main/java/org/hamcrest/BaseDescription.java @@ -108,6 +108,9 @@ private Description appendList(String start, String separator, String end, Itera * Append the String str to the description. * The default implementation passes every character to {@link #append(char)}. * Override in subclasses to provide an efficient implementation. + * + * @param str + * the string to append. */ protected void append(String str) { for (int i = 0; i < str.length(); i++) { @@ -116,7 +119,10 @@ protected void append(String str) { } /** - * Append the char c to the description. + * Append the char c to the description. + * + * @param c + * the char to append. */ protected abstract void append(char c); diff --git a/hamcrest/src/main/java/org/hamcrest/CoreMatchers.java b/hamcrest/src/main/java/org/hamcrest/CoreMatchers.java index 4fd8e74e..0f6b9f06 100644 --- a/hamcrest/src/main/java/org/hamcrest/CoreMatchers.java +++ b/hamcrest/src/main/java/org/hamcrest/CoreMatchers.java @@ -10,6 +10,10 @@ public class CoreMatchers { * For example: *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
* + * @param + * the matcher type. + * @param matchers + * all the matchers must pass. * @return The matcher. */ public static org.hamcrest.Matcher allOf(java.lang.Iterable> matchers) { @@ -21,6 +25,10 @@ public static org.hamcrest.Matcher allOf(java.lang.IterableassertThat("myValue", allOf(startsWith("my"), containsString("Val"))) * + * @param + * the matcher type. + * @param matchers + * all the matchers must pass. * @return The matcher. */ @SafeVarargs @@ -34,6 +42,10 @@ public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher. * For example: *
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
* + * @param + * the matcher type. + * @param matchers + * any the matchers must pass. * @return The matcher. */ public static org.hamcrest.core.AnyOf anyOf(java.lang.Iterable> matchers) { @@ -45,6 +57,10 @@ public static org.hamcrest.core.AnyOf anyOf(java.lang.IterableassertThat("myValue", anyOf(startsWith("foo"), containsString("Val"))) * + * @param + * the matcher type. + * @param matchers + * any the matchers must pass. * @return The matcher. */ @SafeVarargs @@ -57,6 +73,10 @@ public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.MatcherassertThat("fab", both(containsString("a")).and(containsString("b"))) * + * @param + * the matcher type. + * @param matcher + * the matcher to combine, and both musth pass. * @return The matcher. */ public static org.hamcrest.core.CombinableMatcher.CombinableBothMatcher both(org.hamcrest.Matcher matcher) { @@ -68,6 +88,10 @@ public static org.hamcrest.core.CombinableMatcher.CombinableBothMatcherassertThat("fan", either(containsString("a")).or(containsString("b"))) * + * @param + * the matcher type. + * @param matcher + * the matcher to combine, and either must pass. * @return The matcher. */ public static org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher either(org.hamcrest.Matcher matcher) { @@ -80,13 +104,14 @@ public static org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher< * For example: *
describedAs("a big decimal equal to %0", equalTo(myBigDecimal), myBigDecimal.toPlainString())
* + * @param + * the matcher type. * @param description * the new description for the wrapped matcher * @param matcher * the matcher to wrap * @param values * optional values to insert into the tokenised description - * * @return The matcher. */ public static org.hamcrest.Matcher describedAs(java.lang.String description, org.hamcrest.Matcher matcher, java.lang.Object... values) { @@ -100,9 +125,10 @@ public static org.hamcrest.Matcher describedAs(java.lang.String descripti * For example: *
assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
* + * @param + * the matcher type. * @param itemMatcher * the matcher to apply to every item provided by the examined {@link Iterable} - * * @return The matcher. */ public static org.hamcrest.Matcher> everyItem(org.hamcrest.Matcher itemMatcher) { @@ -117,6 +143,10 @@ public static org.hamcrest.Matcher> everyIte * instead of: *
assertThat(cheese, equalTo(smelly))
* + * @param + * the matcher type. + * @param matcher + * the matcher {@link org.hamcrest.core.Is#is}. * @return The matcher. */ public static org.hamcrest.Matcher is(org.hamcrest.Matcher matcher) { @@ -130,6 +160,10 @@ public static org.hamcrest.Matcher is(org.hamcrest.Matcher matcher) { * instead of: *
assertThat(cheese, is(equalTo(smelly)))
* + * @param + * the matcher type. + * @param value + * the value for matcher {@link org.hamcrest.core.Is#is}. * @return The matcher. */ public static org.hamcrest.Matcher is(T value) { @@ -143,6 +177,10 @@ public static org.hamcrest.Matcher is(T value) { * instead of: *
assertThat(cheese, is(instanceOf(Cheddar.class)))
* + * @param + * the matcher type. + * @param type + * the type for matcher {@link org.hamcrest.core.Is#isA}. * @return The matcher. */ public static org.hamcrest.Matcher isA(java.lang.Class type) { @@ -164,7 +202,6 @@ public static org.hamcrest.Matcher anything() { * * @param description * a meaningful {@link String} used when describing itself - * * @return The matcher. */ public static org.hamcrest.Matcher anything(java.lang.String description) { @@ -178,10 +215,11 @@ public static org.hamcrest.Matcher anything(java.lang.String d * will stop as soon as a matching item is found. * For example: *
assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
- * + * + * @param + * the matcher type. * @param itemMatcher * the matcher to apply to items provided by the examined {@link Iterable} - * * @return The matcher. */ public static org.hamcrest.Matcher> hasItem(org.hamcrest.Matcher itemMatcher) { @@ -195,10 +233,11 @@ public static org.hamcrest.Matcher> hasItem(or * will stop as soon as a matching item is found. * For example: *
assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
- * + * + * @param + * the matcher type. * @param item * the item to compare against the items provided by the examined {@link Iterable} - * * @return The matcher. */ public static org.hamcrest.Matcher> hasItem(T item) { @@ -212,10 +251,11 @@ public static org.hamcrest.Matcher> hasItem(T * the examined {@link Iterable} will stop as soon as a matching item is found. * For example: *
assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
- * + * + * @param + * the matcher type. * @param itemMatchers * the matchers to apply to items provided by the examined {@link Iterable} - * * @return The matcher. */ @SafeVarargs @@ -230,10 +270,11 @@ public static org.hamcrest.Matcher> hasItems(org.hamcr * examined {@link Iterable} will stop as soon as a matching item is found. * For example: *
assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
- * + * + * @param + * the matcher type. * @param items * the items to compare against the items provided by the examined {@link Iterable} - * * @return The matcher. */ @SafeVarargs @@ -262,6 +303,10 @@ public static org.hamcrest.Matcher> hasItems(T... item * assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"})); * * + * @param + * the matcher type. + * @param operand + * for matcher {@link org.hamcrest.core.IsEqual#equalTo}. * @return The matcher. */ public static org.hamcrest.Matcher equalTo(T operand) { @@ -272,6 +317,8 @@ public static org.hamcrest.Matcher equalTo(T operand) { * Creates an {@link org.hamcrest.core.IsEqual} matcher that does not enforce the values being * compared to be of the same static type. * + * @param operand + * the object for matcher {@link org.hamcrest.core.IsEqual#equalToObject}. * @return The matcher. */ public static org.hamcrest.Matcher equalToObject(java.lang.Object operand) { @@ -289,6 +336,10 @@ public static org.hamcrest.Matcher equalToObject(java.lang.Obj * For example: *
assertThat(new Canoe(), any(Canoe.class));
* + * @param + * the matcher type. + * @param type + * the type for matcher {@link org.hamcrest.core.IsInstanceOf#any}. * @return The matcher. */ public static org.hamcrest.Matcher any(java.lang.Class type) { @@ -304,6 +355,10 @@ public static org.hamcrest.Matcher any(java.lang.Class type) { * For example: *
assertThat(new Canoe(), instanceOf(Paddlable.class));
* + * @param + * the matcher type. + * @param type + * the type for matcher {@link org.hamcrest.core.IsInstanceOf#instanceOf}. * @return The matcher. */ public static org.hamcrest.Matcher instanceOf(java.lang.Class type) { @@ -315,7 +370,9 @@ public static org.hamcrest.Matcher instanceOf(java.lang.Class type) { * it will match. * For example: *
assertThat(cheese, is(not(equalTo(smelly))))
- * + * + * @param + * the matcher type. * @param matcher * the matcher whose sense should be inverted * @return The matcher. @@ -330,7 +387,9 @@ public static org.hamcrest.Matcher not(org.hamcrest.Matcher matcher) { *
assertThat(cheese, is(not(smelly)))
* instead of: *
assertThat(cheese, is(not(equalTo(smelly))))
- * + * + * @param + * the matcher type. * @param value * the value that any examined object should not equal * @return The matcher. @@ -359,7 +418,9 @@ public static org.hamcrest.Matcher notNullValue() { *
assertThat(cheese, is(notNullValue(X.class)))
* instead of: *
assertThat(cheese, is(not(nullValue(X.class))))
- * + * + * @param + * the matcher type. * @param type * dummy parameter used to infer the generic type of the returned matcher * @return The matcher. @@ -384,7 +445,9 @@ public static org.hamcrest.Matcher nullValue() { * single dummy argument to facilitate type inference. * For example: *
assertThat(cheese, is(nullValue(Cheese.class))
- * + * + * @param + * the matcher type. * @param type * dummy parameter used to infer the generic type of the returned matcher * @return The matcher. @@ -396,7 +459,9 @@ public static org.hamcrest.Matcher nullValue(java.lang.Class type) { /** * Creates a matcher that matches only when the examined object is the same instance as * the specified target object. - * + * + * @param + * the matcher type. * @param target * the target instance against which others should be assessed * @return The matcher. @@ -408,7 +473,9 @@ public static org.hamcrest.Matcher sameInstance(T target) { /** * Creates a matcher that matches only when the examined object is the same instance as * the specified target object. - * + * + * @param + * the matcher type. * @param target * the target instance against which others should be assessed * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/Description.java b/hamcrest/src/main/java/org/hamcrest/Description.java index 1abfd677..becd6e1b 100644 --- a/hamcrest/src/main/java/org/hamcrest/Description.java +++ b/hamcrest/src/main/java/org/hamcrest/Description.java @@ -15,6 +15,8 @@ public interface Description { /** * Appends some plain text to the description. * + * @param text + * the text to append. * @return the update description when displaying the matcher error. */ Description appendText(String text); @@ -22,6 +24,8 @@ public interface Description { /** * Appends the description of a {@link SelfDescribing} value to this description. * + * @param value + * the value to append. * @return the update description when displaying the matcher error. */ Description appendDescriptionOf(SelfDescribing value); @@ -29,6 +33,8 @@ public interface Description { /** * Appends an arbitrary value to the description. * + * @param value + * the object to append. * @return the update description when displaying the matcher error. */ Description appendValue(Object value); @@ -36,6 +42,16 @@ public interface Description { /** * Appends a list of values to the description. * + * @param + * the description type. + * @param start + * the prefix. + * @param separator + * the separator. + * @param end + * the suffix. + * @param values + * the values to append. * @return the update description when displaying the matcher error. */ Description appendValueList(String start, String separator, String end, @@ -44,6 +60,16 @@ Description appendValueList(String start, String separator, String end, /** * Appends a list of values to the description. * + * @param + * the description type. + * @param start + * the prefix. + * @param separator + * the separator. + * @param end + * the suffix. + * @param values + * the values to append. * @return the update description when displaying the matcher error. */ Description appendValueList(String start, String separator, String end, @@ -52,7 +78,14 @@ Description appendValueList(String start, String separator, String end, /** * Appends a list of {@link org.hamcrest.SelfDescribing} objects * to the description. - * + * @param start + * the prefix. + * @param separator + * the separator. + * @param end + * the suffix. + * @param values + * the values to append. * @return the update description when displaying the matcher error. */ Description appendList(String start, String separator, String end, diff --git a/hamcrest/src/main/java/org/hamcrest/DiagnosingMatcher.java b/hamcrest/src/main/java/org/hamcrest/DiagnosingMatcher.java index f87de2df..b8c11dcd 100644 --- a/hamcrest/src/main/java/org/hamcrest/DiagnosingMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/DiagnosingMatcher.java @@ -3,7 +3,7 @@ /** * TODO(ngd): Document. * - * @param + * @param the type of matcher being diagnosed. */ public abstract class DiagnosingMatcher extends BaseMatcher { diff --git a/hamcrest/src/main/java/org/hamcrest/Matchers.java b/hamcrest/src/main/java/org/hamcrest/Matchers.java index 3ea72228..6a0971ca 100644 --- a/hamcrest/src/main/java/org/hamcrest/Matchers.java +++ b/hamcrest/src/main/java/org/hamcrest/Matchers.java @@ -15,6 +15,10 @@ public class Matchers { * For example: *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
* + * @param + * the matcher type. + * @param matchers + * all the matchers must pass. * @return The matcher. */ public static org.hamcrest.Matcher allOf(java.lang.Iterable> matchers) { @@ -26,6 +30,10 @@ public static org.hamcrest.Matcher allOf(java.lang.IterableassertThat("myValue", allOf(startsWith("my"), containsString("Val"))) * + * @param + * the matcher type. + * @param matchers + * all the matchers must pass. * @return The matcher. */ @SafeVarargs @@ -38,6 +46,12 @@ public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher. * For example: *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
* + * @param + * the matcher type. + * @param first + * first matcher that must pass. + * @param second + * second matcher that must pass. * @return The matcher. */ public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second) { @@ -49,6 +63,14 @@ public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher * For example: *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
* + * @param + * the matcher type. + * @param first + * first matcher that must pass. + * @param second + * second matcher that must pass. + * @param third + * third matcher that must pass. * @return The matcher. */ public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher third) { @@ -60,6 +82,16 @@ public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher * For example: *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
* + * @param + * the matcher type. + * @param first + * first matcher that must pass. + * @param second + * second matcher that must pass. + * @param third + * third matcher that must pass. + * @param fourth + * fourth matcher that must pass. * @return The matcher. */ public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher third, org.hamcrest.Matcher fourth) { @@ -71,6 +103,18 @@ public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher * For example: *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
* + * @param + * the matcher type. + * @param first + * first matcher that must pass. + * @param second + * second matcher that must pass. + * @param third + * third matcher that must pass. + * @param fourth + * fourth matcher that must pass. + * @param fifth + * fifth matcher that must pass. * @return The matcher. */ public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher third, org.hamcrest.Matcher fourth, org.hamcrest.Matcher fifth) { @@ -82,6 +126,20 @@ public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher * For example: *
assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
* + * @param + * the matcher type. + * @param first + * first matcher that must pass. + * @param second + * second matcher that must pass. + * @param third + * third matcher that must pass. + * @param fourth + * fourth matcher that must pass. + * @param fifth + * fifth matcher that must pass. + * @param sixth + * sixth matcher that must pass. * @return The matcher. */ public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher third, org.hamcrest.Matcher fourth, org.hamcrest.Matcher fifth, org.hamcrest.Matcher sixth) { @@ -93,6 +151,10 @@ public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher * For example: *
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
* + * @param + * the matcher type. + * @param matchers + * any the matchers must pass. * @return The matcher. */ public static org.hamcrest.core.AnyOf anyOf(java.lang.Iterable> matchers) { @@ -104,6 +166,10 @@ public static org.hamcrest.core.AnyOf anyOf(java.lang.IterableassertThat("myValue", anyOf(startsWith("foo"), containsString("Val"))) * + * @param + * the matcher type. + * @param matchers + * any the matchers must pass. * @return The matcher. */ @SafeVarargs @@ -116,6 +182,12 @@ public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.MatcherassertThat("myValue", anyOf(startsWith("foo"), containsString("Val"))) * + * @param + * the matcher type. + * @param first + * first matcher to check. + * @param second + * second matcher to check. * @return The matcher. */ public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second) { @@ -127,6 +199,14 @@ public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.MatcherassertThat("myValue", anyOf(startsWith("foo"), containsString("Val"))) * + * @param + * the matcher type. + * @param first + * first matcher to check. + * @param second + * second matcher to check. + * @param third + * third matcher to check. * @return The matcher. */ public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher third) { @@ -138,6 +218,16 @@ public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.MatcherassertThat("myValue", anyOf(startsWith("foo"), containsString("Val"))) * + * @param + * the matcher type. + * @param first + * first matcher to check. + * @param second + * second matcher to check. + * @param third + * third matcher to check. + * @param fourth + * fourth matcher to check. * @return The matcher. */ public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher third, org.hamcrest.Matcher fourth) { @@ -149,6 +239,18 @@ public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.MatcherassertThat("myValue", anyOf(startsWith("foo"), containsString("Val"))) * + * @param + * the matcher type. + * @param first + * first matcher to check. + * @param second + * second matcher to check. + * @param third + * third matcher to check. + * @param fourth + * fourth matcher to check. + * @param fifth + * fifth matcher to check. * @return The matcher. */ public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher third, org.hamcrest.Matcher fourth, org.hamcrest.Matcher fifth) { @@ -160,6 +262,20 @@ public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.MatcherassertThat("myValue", anyOf(startsWith("foo"), containsString("Val"))) * + * @param + * the matcher type. + * @param first + * first matcher to check. + * @param second + * second matcher to check. + * @param third + * third matcher to check. + * @param fourth + * fourth matcher to check. + * @param fifth + * fifth matcher to check. + * @param sixth + * sixth matcher to check. * @return The matcher. */ public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher first, org.hamcrest.Matcher second, org.hamcrest.Matcher third, org.hamcrest.Matcher fourth, org.hamcrest.Matcher fifth, org.hamcrest.Matcher sixth) { @@ -171,6 +287,10 @@ public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.MatcherassertThat("fab", both(containsString("a")).and(containsString("b"))) * + * @param + * the matcher type. + * @param matcher + * the matcher to combine, and both must pass. * @return The matcher. */ public static org.hamcrest.core.CombinableMatcher.CombinableBothMatcher both(org.hamcrest.Matcher matcher) { @@ -182,6 +302,10 @@ public static org.hamcrest.core.CombinableMatcher.CombinableBothMatcherassertThat("fan", either(containsString("a")).or(containsString("b"))) * + * @param + * the matcher type. + * @param matcher + * the matcher to combine, and either must pass. * @return The matcher. */ public static org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher either(org.hamcrest.Matcher matcher) { @@ -193,7 +317,9 @@ public static org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher< * delegated to the decorated matcher, including its mismatch description. * For example: *
describedAs("a big decimal equal to %0", equalTo(myBigDecimal), myBigDecimal.toPlainString())
- * + * + * @param + * the matcher type. * @param description * the new description for the wrapped matcher * @param matcher @@ -212,7 +338,9 @@ public static org.hamcrest.Matcher describedAs(java.lang.String descripti * itemMatcher. * For example: *
assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
- * + * + * @param + * the matcher type. * @param itemMatcher * the matcher to apply to every item provided by the examined {@link Iterable} * @return The matcher. @@ -229,6 +357,10 @@ public static org.hamcrest.Matcher> everyIte * instead of: *
assertThat(cheese, equalTo(smelly))
* + * @param + * the matcher type. + * @param matcher + * the matcher to wrap. * @return The matcher. */ public static org.hamcrest.Matcher is(org.hamcrest.Matcher matcher) { @@ -242,6 +374,10 @@ public static org.hamcrest.Matcher is(org.hamcrest.Matcher matcher) { * instead of: *
assertThat(cheese, is(equalTo(smelly)))
* + * @param + * the matcher type. + * @param value + * the value to check. * @return The matcher. */ public static org.hamcrest.Matcher is(T value) { @@ -255,6 +391,10 @@ public static org.hamcrest.Matcher is(T value) { * instead of: *
assertThat(cheese, is(instanceOf(Cheddar.class)))
* + * @param + * the matcher type. + * @param type + * the type to check. * @return The matcher. */ public static org.hamcrest.Matcher isA(java.lang.Class type) { @@ -288,7 +428,9 @@ public static org.hamcrest.Matcher anything(java.lang.String d * will stop as soon as a matching item is found. * For example: *
assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
- * + * + * @param + * the matcher type. * @param itemMatcher * the matcher to apply to items provided by the examined {@link Iterable} * @return The matcher. @@ -304,7 +446,9 @@ public static org.hamcrest.Matcher> hasItem(or * will stop as soon as a matching item is found. * For example: *
assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
- * + * + * @param + * the matcher type. * @param item * the item to compare against the items provided by the examined {@link Iterable} * @return The matcher. @@ -320,7 +464,9 @@ public static org.hamcrest.Matcher> hasItem(T * the examined {@link Iterable} will stop as soon as a matching item is found. * For example: *
assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
- * + * + * @param + * the matcher type. * @param itemMatchers * the matchers to apply to items provided by the examined {@link Iterable} * @return The matcher. @@ -337,7 +483,9 @@ public static org.hamcrest.Matcher> hasItems(org.hamcr * examined {@link Iterable} will stop as soon as a matching item is found. * For example: *
assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
- * + * + * @param + * the matcher type. * @param items * the items to compare against the items provided by the examined {@link Iterable} * @return The matcher. @@ -368,6 +516,10 @@ public static org.hamcrest.Matcher> hasItems(T... item * assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"})); * * + * @param + * the matcher type. + * @param operand + * the value to check. * @return The matcher. */ public static org.hamcrest.Matcher equalTo(T operand) { @@ -378,6 +530,8 @@ public static org.hamcrest.Matcher equalTo(T operand) { * Creates an {@link org.hamcrest.core.IsEqual} matcher that does not enforce the values being * compared to be of the same static type. * + * @param operand + * the value to check. * @return The matcher. */ public static org.hamcrest.Matcher equalToObject(java.lang.Object operand) { @@ -395,6 +549,10 @@ public static org.hamcrest.Matcher equalToObject(java.lang.Obj * For example: *
assertThat(new Canoe(), instanceOf(Canoe.class));
* + * @param + * the matcher type. + * @param type + * the type to check. * @return The matcher. */ public static org.hamcrest.Matcher any(java.lang.Class type) { @@ -410,6 +568,10 @@ public static org.hamcrest.Matcher any(java.lang.Class type) { * For example: *
assertThat(new Canoe(), instanceOf(Paddlable.class));
* + * @param + * the matcher type. + * @param type + * the type to check. * @return The matcher. */ public static org.hamcrest.Matcher instanceOf(java.lang.Class type) { @@ -421,7 +583,9 @@ public static org.hamcrest.Matcher instanceOf(java.lang.Class type) { * it will match. * For example: *
assertThat(cheese, is(not(equalTo(smelly))))
- * + * + * @param + * the matcher type. * @param matcher * the matcher whose sense should be inverted * @return The matcher. @@ -436,7 +600,9 @@ public static org.hamcrest.Matcher not(org.hamcrest.Matcher matcher) { *
assertThat(cheese, is(not(smelly)))
* instead of: *
assertThat(cheese, is(not(equalTo(smelly))))
- * + * + * @param + * the matcher type. * @param value * the value that any examined object should not equal * @return The matcher. @@ -465,7 +631,9 @@ public static org.hamcrest.Matcher notNullValue() { *
assertThat(cheese, is(notNullValue(X.class)))
* instead of: *
assertThat(cheese, is(not(nullValue(X.class))))
- * + * + * @param + * the matcher type. * @param type * dummy parameter used to infer the generic type of the returned matcher * @return The matcher. @@ -490,7 +658,9 @@ public static org.hamcrest.Matcher nullValue() { * single dummy argument to facilitate type inference. * For example: *
assertThat(cheese, is(nullValue(Cheese.class))
- * + * + * @param + * the matcher type. * @param type * dummy parameter used to infer the generic type of the returned matcher * @return The matcher. @@ -502,7 +672,9 @@ public static org.hamcrest.Matcher nullValue(java.lang.Class type) { /** * Creates a matcher that matches only when the examined object is the same instance as * the specified target object. - * + * + * @param + * the matcher type. * @param target * the target instance against which others should be assessed * @return The matcher. @@ -514,7 +686,9 @@ public static org.hamcrest.Matcher sameInstance(T target) { /** * Creates a matcher that matches only when the examined object is the same instance as * the specified target object. - * + * + * @param + * the matcher type. * @param target * the target instance against which others should be assessed * @return The matcher. @@ -647,7 +821,9 @@ public static Matcher matchesRegex(String regex) { * each matcher[i] is satisfied by array[i]. * For example: *
assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))
- * + * + * @param + * the matcher type. * @param elementMatchers * the matchers that the elements of examined arrays should satisfy * @return The matcher. @@ -663,7 +839,9 @@ public static org.hamcrest.collection.IsArray array(org.hamcrest.Matcher< * 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 + * the matcher type. * @param elementMatcher * the matcher to apply to elements in examined arrays * @return The matcher. @@ -678,7 +856,9 @@ public static org.hamcrest.Matcher hasItemInArray(org.hamcrest.Matcher< *
assertThat(hasItemInArray(x))
* instead of: *
assertThat(hasItemInArray(equalTo(x)))
- * + * + * @param + * the matcher type. * @param element * the element that should be present in examined arrays * @return The matcher. @@ -693,7 +873,9 @@ public static org.hamcrest.Matcher hasItemInArray(T element) { * the examined array must be of the same length as the number of specified items. * For example: *
assertThat(new String[]{"foo", "bar"}, arrayContaining("foo", "bar"))
- * + * + * @param + * the matcher type. * @param items * the items that must equal the items within an examined array * @return The matcher. @@ -709,7 +891,9 @@ public static org.hamcrest.Matcher arrayContaining(E... items) { * must be of the same length as the number of specified matchers. * For example: *
assertThat(new String[]{"foo", "bar"}, arrayContaining(equalTo("foo"), equalTo("bar")))
- * + * + * @param + * the matcher type. * @param itemMatchers * the matchers that must be satisfied by the items in the examined array * @return The matcher. @@ -725,7 +909,9 @@ public static org.hamcrest.Matcher arrayContaining(org.hamcrest.Matcher * must be of the same length as the specified list of matchers. * For example: *
assertThat(new String[]{"foo", "bar"}, arrayContaining(Arrays.asList(equalTo("foo"), equalTo("bar"))))
- * + * + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by the corresponding item in an examined array * @return The matcher. @@ -750,7 +936,9 @@ public static org.hamcrest.Matcher arrayContaining(java.util.List *
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(equalTo("bar"), equalTo("foo")))
- * + * + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by an entry in an examined array * @return The matcher. @@ -776,7 +964,9 @@ public static org.hamcrest.Matcher arrayContainingInAnyOrder(org.hamcre * For example: *

*
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
- * + * + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by an item provided by an examined array * @return The matcher. @@ -799,7 +989,9 @@ public static org.hamcrest.Matcher arrayContainingInAnyOrder(java.util. * For example: *

*
assertThat(new String[]{"foo", "bar"}, arrayContainingInAnyOrder("bar", "foo"))
- * + * + * @param + * the matcher type. * @param items * the items that must equal the entries of an examined array, in any order * @return The matcher. @@ -814,7 +1006,9 @@ public static org.hamcrest.Matcher arrayContainingInAnyOrder(E... items * satisfies the specified matcher. * For example: *
assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))
- * + * + * @param + * the matcher type. * @param sizeMatcher * a matcher for the length of an examined array * @return The matcher. @@ -828,7 +1022,9 @@ public static org.hamcrest.Matcher arrayWithSize(org.hamcrest.Matchersize. * For example: *
assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))
- * + * + * @param + * the matcher type. * @param size * the length that an examined array must have for a positive match * @return The matcher. @@ -843,6 +1039,8 @@ public static org.hamcrest.Matcher arrayWithSize(int size) { * For example: *
assertThat(new String[0], emptyArray())
* + * @param + * the matcher type. * @return The matcher. */ public static org.hamcrest.Matcher emptyArray() { @@ -854,7 +1052,11 @@ public static org.hamcrest.Matcher emptyArray() { * a value that satisfies the specified matcher. * For example: *
assertThat(myMap, is(aMapWithSize(equalTo(2))))
- * + * + * @param + * the map key type. + * @param + * the map value type. * @param sizeMatcher * a matcher for the size of an examined {@link java.util.Map} * @return The matcher. @@ -868,7 +1070,11 @@ public static org.hamcrest.Matcher * a value equal to the specified size. * For example: *
assertThat(myMap, is(aMapWithSize(2)))
- * + * + * @param + * the map key type. + * @param + * the map value type. * @param size * the expected size of an examined {@link java.util.Map} * @return The matcher. @@ -883,6 +1089,10 @@ public static org.hamcrest.Matcher * For example: *
assertThat(myMap, is(anEmptyMap()))
* + * @param + * the map key type. + * @param + * the map value type. * @return The matcher. */ public static org.hamcrest.Matcher> anEmptyMap() { @@ -894,7 +1104,9 @@ public static org.hamcrest.Matcher * a value that satisfies the specified matcher. * For example: *
assertThat(Arrays.asList("foo", "bar"), hasSize(equalTo(2)))
- * + * + * @param + * the matcher type. * @param sizeMatcher * a matcher for the size of an examined {@link java.util.Collection} * @return The matcher. @@ -908,7 +1120,9 @@ public static org.hamcrest.Matcher> hasSiz * a value equal to the specified size. * For example: *
assertThat(Arrays.asList("foo", "bar"), hasSize(2))
- * + * + * @param + * the matcher type. * @param size * the expected size of an examined {@link java.util.Collection} * @return The matcher. @@ -923,6 +1137,8 @@ public static org.hamcrest.Matcher> hasSiz * For example: *
assertThat(new ArrayList<String>(), is(empty()))
* + * @param + * the matcher type. * @return The matcher. */ public static org.hamcrest.Matcher> empty() { @@ -934,7 +1150,9 @@ public static org.hamcrest.Matcher> empty( * method returns true. * For example: *
assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
- * + * + * @param + * the matcher type. * @param unusedToForceReturnType * the type of the collection's content * @return The matcher. @@ -948,6 +1166,8 @@ public static org.hamcrest.Matcher> emptyCollectionO * For example: *
assertThat(new ArrayList<String>(), is(emptyIterable()))
* + * @param + * the matcher type. * @return The matcher. */ public static org.hamcrest.Matcher> emptyIterable() { @@ -958,7 +1178,9 @@ public static org.hamcrest.Matcher> emptyIte * Creates a matcher for {@link Iterable}s matching examined iterables that yield no items. * For example: *
assertThat(new ArrayList<String>(), is(emptyIterableOf(String.class)))
- * + * + * @param + * the matcher type. * @param unusedToForceReturnType * the type of the iterable's content * @return The matcher. @@ -974,7 +1196,9 @@ public static org.hamcrest.Matcher> emptyIterableOf(ja * must be of the same length as the number of specified items. * For example: *
assertThat(Arrays.asList("foo", "bar"), contains("foo", "bar"))
- * + * + * @param + * the matcher type. * @param items * the items that must equal the items provided by an examined {@link Iterable} * @return The matcher. @@ -990,7 +1214,9 @@ public static org.hamcrest.Matcher> contains * For a positive match, the examined iterable must only yield one item. * For example: *
assertThat(Arrays.asList("foo"), contains(equalTo("foo")))
- * + * + * @param + * the matcher type. * @param itemMatcher * the matcher that must be satisfied by the single item provided by an * examined {@link Iterable} @@ -1007,7 +1233,9 @@ public static org.hamcrest.Matcher> contains * must be of the same length as the number of specified matchers. * For example: *
assertThat(Arrays.asList("foo", "bar"), contains(equalTo("foo"), equalTo("bar")))
- * + * + * @param + * the matcher type. * @param itemMatchers * the matchers that must be satisfied by the items provided by an examined {@link Iterable} * @return The matcher. @@ -1024,7 +1252,9 @@ public static org.hamcrest.Matcher> contains * must be of the same length as the specified list of matchers. * For example: *
assertThat(Arrays.asList("foo", "bar"), contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
- * + * + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by the corresponding item provided by * an examined {@link Iterable} @@ -1050,7 +1280,9 @@ public static org.hamcrest.Matcher> contains * For example: *

*
assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(equalTo("bar"), equalTo("foo")))
- * + * + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by an item provided by an examined {@link Iterable} * @return The matcher. @@ -1076,7 +1308,9 @@ public static org.hamcrest.Matcher> contains * For example: *

*
assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))
- * + * + * @param + * the matcher type. * @param items * the items that must equal the items provided by an examined {@link Iterable} in any order * @return The matcher. @@ -1100,7 +1334,9 @@ public static org.hamcrest.Matcher> contains *

*

For example:

*
assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder(Arrays.asList(equalTo("bar"), equalTo("foo"))))
- * + * + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by an item provided by an examined {@link Iterable} * @return The matcher. @@ -1115,7 +1351,9 @@ public static org.hamcrest.Matcher> contains * corresponding item in the specified items, in the same relative order * For example: *
assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder("b", "d"))
- * + * + * @param + * the matcher type. * @param items * the items that must be contained within items provided by an examined {@link Iterable} in the same relative order * @return The matcher. @@ -1131,7 +1369,9 @@ public static org.hamcrest.Matcher> contains * matcher in the specified matchers, in the same relative order. * For example: *
assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder(equalTo("b"), equalTo("d")))
- * + * + * @param + * the matcher type. * @param itemMatchers * the matchers that must be satisfied by the items provided by an examined {@link Iterable} in the same relative order * @return The matcher. @@ -1147,7 +1387,9 @@ public static org.hamcrest.Matcher> contains * matcher in the specified list of matchers, in the same relative order. * For example: *
assertThat(Arrays.asList("a", "b", "c", "d", "e"), contains(Arrays.asList(equalTo("b"), equalTo("d"))))
- * + * + * @param + * the matcher type. * @param itemMatchers * a list of matchers, each of which must be satisfied by the items provided by * an examined {@link Iterable} in the same relative order @@ -1163,7 +1405,9 @@ public static org.hamcrest.Matcher> contains * matcher. * For example: *
assertThat(Arrays.asList("foo", "bar"), iterableWithSize(equalTo(2)))
- * + * + * @param + * the matcher type. * @param sizeMatcher * a matcher for the number of items that should be yielded by an examined {@link Iterable} * @return The matcher. @@ -1178,7 +1422,9 @@ public static org.hamcrest.Matcher> iterableWithSize(o * size argument. * For example: *
assertThat(Arrays.asList("foo", "bar"), iterableWithSize(2))
- * + * + * @param + * the matcher type. * @param size * the number of items that should be yielded by an examined {@link Iterable} * @return The matcher. @@ -1193,7 +1439,11 @@ public static org.hamcrest.Matcher> iterableWithSize(i * value satisfies the specified valueMatcher. * For example: *
assertThat(myMap, hasEntry(equalTo("bar"), equalTo("foo")))
- * + * + * @param + * the map key type. + * @param + * the map value type. * @param keyMatcher * the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entry * @param valueMatcher @@ -1210,7 +1460,11 @@ public static org.hamcrest.Matcher * specified value. * For example: *
assertThat(myMap, hasEntry("bar", "foo"))
- * + * + * @param + * the map key type. + * @param + * the map value type. * @param key * the key that, in combination with the value, must be describe at least one entry * @param value @@ -1226,7 +1480,9 @@ public static org.hamcrest.Matcher * at least one key that satisfies the specified matcher. * For example: *
assertThat(myMap, hasKey(equalTo("bar")))
- * + * + * @param + * the map key type. * @param keyMatcher * the matcher that must be satisfied by at least one key * @return The matcher. @@ -1240,7 +1496,9 @@ public static org.hamcrest.Matcher> hasKey(org. * at least one key that is equal to the specified key. * For example: *
assertThat(myMap, hasKey("bar"))
- * + * + * @param + * the map key type. * @param key * the key that satisfying maps must contain * @return The matcher. @@ -1254,7 +1512,9 @@ public static org.hamcrest.Matcher> hasKey(K ke * at least one value that satisfies the specified valueMatcher. * For example: *
assertThat(myMap, hasValue(equalTo("foo")))
- * + * + * @param + * the value type. * @param valueMatcher * the matcher that must be satisfied by at least one value * @return The matcher. @@ -1268,7 +1528,9 @@ public static org.hamcrest.Matcher> hasValue(or * at least one value that is equal to the specified value. * For example: *
assertThat(myMap, hasValue("foo"))
- * + * + * @param + * the value type. * @param value * the value that satisfying maps must contain * @return The matcher. @@ -1282,7 +1544,9 @@ public static org.hamcrest.Matcher> hasValue(V * specified collection. * For example: *
assertThat("foo", is(in(Arrays.asList("bar", "foo"))))
- * + * + * @param + * the matcher type. * @param collection * the collection in which matching items must be found * @return The matcher. @@ -1296,7 +1560,9 @@ public static org.hamcrest.Matcher in(java.util.Collection collection) * specified array. * For example: *
assertThat("foo", is(in(new String[]{"bar", "foo"})))
- * + * + * @param + * the matcher type. * @param elements * the array in which matching items must be found * @return The matcher. @@ -1310,7 +1576,9 @@ public static org.hamcrest.Matcher in(T[] elements) { * specified collection. * For example: *
assertThat("foo", isIn(Arrays.asList("bar", "foo")))
- * + * + * @param + * the matcher type. * @deprecated use is(in(...)) instead * @param collection * the collection in which matching items must be found @@ -1326,8 +1594,10 @@ public static org.hamcrest.Matcher isIn(java.util.Collection collectio * specified array. * For example: *
assertThat("foo", isIn(new String[]{"bar", "foo"}))
- * + * * @deprecated use is(in(...)) instead + * @param + * the matcher type. * @param elements * the array in which matching items must be found * @return The matcher. @@ -1344,6 +1614,8 @@ public static org.hamcrest.Matcher isIn(T[] elements) { *
assertThat("foo", isOneOf("bar", "foo"))
* * @deprecated use is(oneOf(...)) instead + * @param + * the matcher type. * @param elements * the elements amongst which matching items will be found * @return The matcher. @@ -1359,7 +1631,9 @@ public static org.hamcrest.Matcher isOneOf(T... elements) { * specified elements. * For example: *
assertThat("foo", is(oneOf("bar", "foo")))
- * + * + * @param + * the matcher type. * @param elements * the elements amongst which matching items will be found * @return The matcher. @@ -1419,7 +1693,9 @@ public static org.hamcrest.Matcher closeTo(java.math.BigDe * examined object. * For example: *
assertThat(1, comparesEqualTo(1))
- * + * + * @param + * the matcher type. * @param value the value which, when passed to the compareTo method of the examined object, should return zero * @return The matcher. */ @@ -1433,7 +1709,9 @@ public static > org.hamcrest.Matcher compar * examined object. * For example: *
assertThat(2, greaterThan(1))
- * + * + * @param + * the matcher type. * @param value the value which, when passed to the compareTo method of the examined object, should return greater * than zero * @return The matcher. @@ -1448,7 +1726,9 @@ public static > org.hamcrest.Matcher greate * of the examined object. * For example: *
assertThat(1, greaterThanOrEqualTo(1))
- * + * + * @param + * the matcher type. * @param value the value which, when passed to the compareTo method of the examined object, should return greater * than or equal to zero * @return The matcher. @@ -1463,7 +1743,9 @@ public static > org.hamcrest.Matcher greate * examined object. * For example: *
assertThat(1, lessThan(2))
- * + * + * @param + * the matcher type. * @param value the value which, when passed to the compareTo method of the examined object, should return less * than zero * @return The matcher. @@ -1478,7 +1760,9 @@ public static > org.hamcrest.Matcher lessTh * of the examined object. * For example: *
assertThat(1, lessThanOrEqualTo(1))
- * + * + * @param + * the matcher type. * @param value the value which, when passed to the compareTo method of the examined object, should return less * than or equal to zero * @return The matcher. @@ -1608,6 +1892,8 @@ public static Matcher blankString() { * Creates a matcher of {@link java.lang.String} that matches when the examined string * exactly matches the given {@link java.util.regex.Pattern}. * + * @param pattern + * the text pattern to match. * @return The matcher. */ public static Matcher matchesPattern(java.util.regex.Pattern pattern) { @@ -1618,6 +1904,8 @@ public static Matcher matchesPattern(java.util.regex.Pattern p * 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}. * + * @param regex + * the regex to match. * @return The matcher. */ public static Matcher matchesPattern(java.lang.String regex) { @@ -1691,7 +1979,9 @@ public static Matcher hasLength(int length) { * returns a value that satisfies the specified matcher. * For example: *
assertThat(true, hasToString(equalTo("TRUE")))
- * + * + * @param + * the matcher type. * @param toStringMatcher * the matcher used to verify the toString result * @return The matcher. @@ -1705,7 +1995,9 @@ public static org.hamcrest.Matcher hasToString(org.hamcrest.MatcherassertThat(true, hasToString("TRUE")) - * + * + * @param + * the matcher type. * @param expectedToString * the expected toString result * @return The matcher. @@ -1719,7 +2011,9 @@ public static org.hamcrest.Matcher hasToString(java.lang.String expectedT * assignable from the examined class. * For example: *
assertThat(Integer.class, typeCompatibleWith(Number.class))
- * + * + * @param + * the matcher type. * @param baseType * the base class to examine classes against * @return The matcher. @@ -1763,7 +2057,9 @@ public static org.hamcrest.Matcher eventFrom(java.lang.Ob * with the specified name. * For example: *
assertThat(myBean, hasProperty("foo"))
- * + * + * @param + * the matcher type. * @param propertyName * the name of the JavaBean property that examined beans should possess * @return The matcher. @@ -1777,7 +2073,9 @@ public static org.hamcrest.Matcher hasProperty(java.lang.String propertyN * with the specified name whose value satisfies the specified matcher. * For example: *
assertThat(myBean, hasProperty("foo", equalTo("bar"))
- * + * + * @param + * the matcher type. * @param propertyName * the name of the JavaBean property that examined beans should possess * @param valueMatcher @@ -1798,6 +2096,8 @@ public static org.hamcrest.Matcher hasProperty(java.lang.String propertyN *
assertThat(myBean, samePropertyValuesAs(myExpectedBean))
*
assertThat(myBean, samePropertyValuesAs(myExpectedBean), "age", "height")
* + * @param + * the matcher type. * @param expectedBean * the bean against which examined beans are compared * @param ignoredProperties diff --git a/hamcrest/src/main/java/org/hamcrest/StringDescription.java b/hamcrest/src/main/java/org/hamcrest/StringDescription.java index c902f80f..8adc996c 100644 --- a/hamcrest/src/main/java/org/hamcrest/StringDescription.java +++ b/hamcrest/src/main/java/org/hamcrest/StringDescription.java @@ -20,7 +20,7 @@ public StringDescription(Appendable out) { * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing - * The object to be described. + * The object to be described. * @return * The description of the object. */ @@ -31,6 +31,8 @@ public static String toString(SelfDescribing selfDescribing) { /** * Alias for {@link #toString(SelfDescribing)}. * + * @param selfDescribing + * The object to be described. * @return * The description of the object. */ diff --git a/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java b/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java index b13c1d4b..20902e41 100644 --- a/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java @@ -10,6 +10,7 @@ * To use, implement
matchesSafely()
. * * @param + * the matcher type. * @author Neil Dunn * @author Nat Pryce * @author Steve Freeman @@ -22,6 +23,10 @@ public abstract class TypeSafeDiagnosingMatcher extends BaseMatcher { * Subclasses should implement this. The item will already have been checked * for the specific type and will never be null. * + * @param item + * the item. + * @param mismatchDescription + * the mismatch description. * @return boolean true/false depending if item matches matcher. */ protected abstract boolean matchesSafely(T item, Description mismatchDescription); @@ -29,6 +34,7 @@ public abstract class TypeSafeDiagnosingMatcher extends BaseMatcher { /** * Use this constructor if the subclass that implements matchesSafely * is not the class that binds <T> to a type. + * * @param expectedType The expectedType of the actual value. */ protected TypeSafeDiagnosingMatcher(Class expectedType) { @@ -37,7 +43,8 @@ protected TypeSafeDiagnosingMatcher(Class expectedType) { /** * Use this constructor if the subclass that implements matchesSafely - * is not the class that binds <T> to a type. + * is not the class that binds <T> to a type. + * * @param typeFinder A type finder to extract the type */ protected TypeSafeDiagnosingMatcher(ReflectiveTypeFinder typeFinder) { diff --git a/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java b/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java index ed7b08e3..0f490d0d 100644 --- a/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java @@ -6,6 +6,8 @@ * 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. * + * @param + * the matcher type. * @author Joe Walnes * @author Steve Freeman * @author Nat Pryce @@ -33,7 +35,8 @@ protected TypeSafeMatcher(Class expectedType) { /** * Use this constructor if the subclass that implements matchesSafely - * is not the class that binds <T> to a type. + * is not the class that binds <T> to a type. + * * @param typeFinder A type finder to extract the type */ protected TypeSafeMatcher(ReflectiveTypeFinder typeFinder) { @@ -44,6 +47,8 @@ protected TypeSafeMatcher(ReflectiveTypeFinder typeFinder) { * Subclasses should implement this. The item will already have been checked for * the specific type and will never be null. * + * @param item + * the type safe item to match against. * @return boolean true/false depending if item matches matcher. */ protected abstract boolean matchesSafely(T item); @@ -51,6 +56,11 @@ protected TypeSafeMatcher(ReflectiveTypeFinder typeFinder) { /** * Subclasses should override this. The item will already have been checked for * the specific type and will never be null. + * + * @param item + * the type safe item to match against. + * @param mismatchDescription + * the mismatch description. */ protected void describeMismatchSafely(T item, Description mismatchDescription) { super.describeMismatch(item, mismatchDescription); @@ -60,6 +70,9 @@ protected void describeMismatchSafely(T item, Description mismatchDescription) { * Methods made final to prevent accidental override. * If you need to override this, there's no point on extending TypeSafeMatcher. * Instead, extend the {@link BaseMatcher}. + * + * @param item + * the type safe item to match against. */ @Override @SuppressWarnings({"unchecked"}) From 869367a298f5847138b84bdce7353f45e55d3020 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 15:54:56 +0000 Subject: [PATCH 11/54] JavaDoc only @param org.hamcrest.integration --- .../main/java/org/hamcrest/integration/EasyMock2Adapter.java | 2 ++ .../src/main/java/org/hamcrest/integration/JMock1Adapter.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/hamcrest-integration/src/main/java/org/hamcrest/integration/EasyMock2Adapter.java b/hamcrest-integration/src/main/java/org/hamcrest/integration/EasyMock2Adapter.java index d5ce5257..f7031907 100644 --- a/hamcrest-integration/src/main/java/org/hamcrest/integration/EasyMock2Adapter.java +++ b/hamcrest-integration/src/main/java/org/hamcrest/integration/EasyMock2Adapter.java @@ -19,6 +19,8 @@ public class EasyMock2Adapter implements IArgumentMatcher { * EasyMock {@link org.easymock.IArgumentMatcher} and * report it to EasyMock so it can be kept track of. * + * @param matcher + * the matcher to adapt to EasyMock constraint. * @return The EasyMock matcher. */ public static IArgumentMatcher adapt(Matcher matcher) { diff --git a/hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java b/hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java index 168d79b9..86f69d8b 100644 --- a/hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java +++ b/hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java @@ -19,6 +19,8 @@ public class JMock1Adapter implements Constraint { * Hamcrest {@link org.hamcrest.Matcher} to act as an * jMock {@link org.jmock.core.Constraint}. * + * @param matcher + * the matcher to adapt to jMock constraint. * @return The jMock constraint. */ public static Constraint adapt(Matcher matcher) { From 9c8ed040df628161f33df6e0ca58a64bb5b8fd31 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 19:52:53 +0000 Subject: [PATCH 12/54] GitHub Actions Default Java/OS first and QA last --- .github/workflows/ci.yaml | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6ec0cf37..9d5e6850 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,15 +4,30 @@ name: Java CI on: [push] jobs: + build: + name: Build Default Java/OS + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 7 + - name: Gradle Clean Build + run: ./gradlew clean build + test: + name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-18.04, ubuntu-20.04] java: [7, 8, 11, 17, 18-ea, 19-ea] + exclude: + - os: ubuntu-18.04 + java: 7 fail-fast: false max-parallel: 4 - name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} steps: - uses: actions/checkout@v2 @@ -20,7 +35,18 @@ jobs: uses: actions/setup-java@v1 with: java-version: ${{ matrix.java }} - - name: Build with Gradle - run: ./gradlew clean build javadoc + - name: Gradle Clean Build + run: ./gradlew clean build + qa: + name: QA Steps + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 7 + - name: Gradle JavaDoc + run: ./gradlew javadoc ... \ No newline at end of file From 6294fb5bde2f5a6a262cf40d8dcd3628121c33a0 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 19:56:54 +0000 Subject: [PATCH 13/54] GitHub Actions job needs usage --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9d5e6850..9ee8687c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,6 +18,7 @@ jobs: test: name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} + needs: build runs-on: ${{ matrix.os }} strategy: matrix: @@ -39,6 +40,7 @@ jobs: run: ./gradlew clean build qa: name: QA Steps + needs: test runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 From 9629b338c57d1d0dc0c38702a2b075c85de026e0 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:00:03 +0000 Subject: [PATCH 14/54] GitHub Actions concurrency cancel-in-progress --- .github/workflows/ci.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9ee8687c..5f8a1ae5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,6 +3,10 @@ name: Java CI on: [push] +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + jobs: build: name: Build Default Java/OS From c884d91a7c21819ac2c1f6f60c975ac955f28aec Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:46:10 +0000 Subject: [PATCH 15/54] Java Code Style EOF org.hamcrest --- hamcrest/src/main/java/org/hamcrest/BaseDescription.java | 1 + hamcrest/src/main/java/org/hamcrest/BaseMatcher.java | 1 + hamcrest/src/main/java/org/hamcrest/Condition.java | 1 + hamcrest/src/main/java/org/hamcrest/CustomMatcher.java | 1 + hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java | 1 + hamcrest/src/main/java/org/hamcrest/Description.java | 1 + hamcrest/src/main/java/org/hamcrest/DiagnosingMatcher.java | 1 + hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java | 1 + hamcrest/src/main/java/org/hamcrest/Matcher.java | 1 + hamcrest/src/main/java/org/hamcrest/MatcherAssert.java | 1 + hamcrest/src/main/java/org/hamcrest/Matchers.java | 1 - hamcrest/src/main/java/org/hamcrest/SelfDescribing.java | 3 ++- hamcrest/src/main/java/org/hamcrest/StringDescription.java | 1 + .../src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java | 1 + hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java | 1 + hamcrest/src/test/java/org/hamcrest/BaseDescriptionTest.java | 1 + hamcrest/src/test/java/org/hamcrest/BaseMatcherTest.java | 1 + hamcrest/src/test/java/org/hamcrest/CustomMatcherTest.java | 1 + .../src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java | 1 + hamcrest/src/test/java/org/hamcrest/MatcherAssertTest.java | 1 + hamcrest/src/test/java/org/hamcrest/TypeSafeMatcherTest.java | 1 + 21 files changed, 21 insertions(+), 2 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/BaseDescription.java b/hamcrest/src/main/java/org/hamcrest/BaseDescription.java index 10a96969..5f692b8a 100644 --- a/hamcrest/src/main/java/org/hamcrest/BaseDescription.java +++ b/hamcrest/src/main/java/org/hamcrest/BaseDescription.java @@ -155,4 +155,5 @@ private void toJavaSyntax(char ch) { append(ch); } } + } diff --git a/hamcrest/src/main/java/org/hamcrest/BaseMatcher.java b/hamcrest/src/main/java/org/hamcrest/BaseMatcher.java index aaa6e957..a142522a 100644 --- a/hamcrest/src/main/java/org/hamcrest/BaseMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/BaseMatcher.java @@ -39,4 +39,5 @@ protected static boolean isNotNull(Object actual, Description mismatch) { } return true; } + } diff --git a/hamcrest/src/main/java/org/hamcrest/Condition.java b/hamcrest/src/main/java/org/hamcrest/Condition.java index 02ce09e6..922c1dfc 100644 --- a/hamcrest/src/main/java/org/hamcrest/Condition.java +++ b/hamcrest/src/main/java/org/hamcrest/Condition.java @@ -66,4 +66,5 @@ private static final class NotMatched extends Condition { return notMatched(); } } + } diff --git a/hamcrest/src/main/java/org/hamcrest/CustomMatcher.java b/hamcrest/src/main/java/org/hamcrest/CustomMatcher.java index 036a7640..c040d6be 100644 --- a/hamcrest/src/main/java/org/hamcrest/CustomMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/CustomMatcher.java @@ -34,4 +34,5 @@ public CustomMatcher(String description) { public final void describeTo(Description description) { description.appendText(fixedDescription); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java b/hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java index 22c2b357..8131514e 100644 --- a/hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java @@ -35,4 +35,5 @@ public CustomTypeSafeMatcher(String description) { public final void describeTo(Description description) { description.appendText(fixedDescription); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/Description.java b/hamcrest/src/main/java/org/hamcrest/Description.java index becd6e1b..acaff588 100644 --- a/hamcrest/src/main/java/org/hamcrest/Description.java +++ b/hamcrest/src/main/java/org/hamcrest/Description.java @@ -131,4 +131,5 @@ public String toString() { return ""; } } + } diff --git a/hamcrest/src/main/java/org/hamcrest/DiagnosingMatcher.java b/hamcrest/src/main/java/org/hamcrest/DiagnosingMatcher.java index b8c11dcd..54e9bf14 100644 --- a/hamcrest/src/main/java/org/hamcrest/DiagnosingMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/DiagnosingMatcher.java @@ -18,4 +18,5 @@ public final void describeMismatch(Object item, Description mismatchDescription) } protected abstract boolean matches(Object item, Description mismatchDescription); + } diff --git a/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java b/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java index 385cf999..71bcbed2 100644 --- a/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java @@ -51,4 +51,5 @@ public final void describeTo(Description description) { description.appendText(featureDescription).appendText(" ") .appendDescriptionOf(subMatcher); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/Matcher.java b/hamcrest/src/main/java/org/hamcrest/Matcher.java index 77e09d5b..79735c0d 100644 --- a/hamcrest/src/main/java/org/hamcrest/Matcher.java +++ b/hamcrest/src/main/java/org/hamcrest/Matcher.java @@ -64,4 +64,5 @@ public interface Matcher extends SelfDescribing { */ @Deprecated void _dont_implement_Matcher___instead_extend_BaseMatcher_(); + } diff --git a/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java b/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java index bc001ebb..c6b1b92b 100644 --- a/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java +++ b/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java @@ -26,4 +26,5 @@ public static void assertThat(String reason, boolean assertion) { throw new AssertionError(reason); } } + } diff --git a/hamcrest/src/main/java/org/hamcrest/Matchers.java b/hamcrest/src/main/java/org/hamcrest/Matchers.java index 6a0971ca..6c1ba01b 100644 --- a/hamcrest/src/main/java/org/hamcrest/Matchers.java +++ b/hamcrest/src/main/java/org/hamcrest/Matchers.java @@ -2173,5 +2173,4 @@ public static org.hamcrest.Matcher hasXPath(java.lang.String x return org.hamcrest.xml.HasXPath.hasXPath(xPath, namespaceContext); } - } diff --git a/hamcrest/src/main/java/org/hamcrest/SelfDescribing.java b/hamcrest/src/main/java/org/hamcrest/SelfDescribing.java index d3aa6db7..85daba4d 100644 --- a/hamcrest/src/main/java/org/hamcrest/SelfDescribing.java +++ b/hamcrest/src/main/java/org/hamcrest/SelfDescribing.java @@ -13,4 +13,5 @@ public interface SelfDescribing { * The description to be built or appended to. */ void describeTo(Description description); -} \ No newline at end of file + +} diff --git a/hamcrest/src/main/java/org/hamcrest/StringDescription.java b/hamcrest/src/main/java/org/hamcrest/StringDescription.java index 8adc996c..8431c45f 100644 --- a/hamcrest/src/main/java/org/hamcrest/StringDescription.java +++ b/hamcrest/src/main/java/org/hamcrest/StringDescription.java @@ -65,4 +65,5 @@ protected void append(char c) { public String toString() { return out.toString(); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java b/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java index 20902e41..31497f01 100644 --- a/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java @@ -80,4 +80,5 @@ public final void describeMismatch(Object item, Description mismatchDescription) matchesSafely((T) item, mismatchDescription); } } + } diff --git a/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java b/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java index 0f490d0d..2ea81a9f 100644 --- a/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java @@ -97,4 +97,5 @@ final public void describeMismatch(Object item, Description description) { describeMismatchSafely((T)item, description); } } + } diff --git a/hamcrest/src/test/java/org/hamcrest/BaseDescriptionTest.java b/hamcrest/src/test/java/org/hamcrest/BaseDescriptionTest.java index afbdd65f..6a6e13ee 100644 --- a/hamcrest/src/test/java/org/hamcrest/BaseDescriptionTest.java +++ b/hamcrest/src/test/java/org/hamcrest/BaseDescriptionTest.java @@ -111,4 +111,5 @@ public final class BaseDescriptionTest { baseDescription.appendValue(value); assertEquals("<" + expected + ">", result.toString()); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/BaseMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/BaseMatcherTest.java index e663f041..136fe9a1 100644 --- a/hamcrest/src/test/java/org/hamcrest/BaseMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/BaseMatcherTest.java @@ -23,4 +23,5 @@ public void describeTo(Description description) { assertEquals("SOME DESCRIPTION", someMatcher.toString()); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/CustomMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/CustomMatcherTest.java index 08649f7a..43cf58b0 100644 --- a/hamcrest/src/test/java/org/hamcrest/CustomMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/CustomMatcherTest.java @@ -17,4 +17,5 @@ public boolean matches(Object item) { assertDescription("I match strings", matcher); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java index 2c867126..e6c4e4c6 100644 --- a/hamcrest/src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java @@ -38,4 +38,5 @@ public void describeMismatchSafely(String item, Description mismatchDescription) copesWithUnknownTypes() { assertUnknownTypeSafe(customMatcher); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/MatcherAssertTest.java b/hamcrest/src/test/java/org/hamcrest/MatcherAssertTest.java index 8d88daa8..556e06bd 100644 --- a/hamcrest/src/test/java/org/hamcrest/MatcherAssertTest.java +++ b/hamcrest/src/test/java/org/hamcrest/MatcherAssertTest.java @@ -96,4 +96,5 @@ public void describeMismatch(Object item, Description mismatchDescription) { canAssertSubtypes() { assertThat(1, equalTo((Number) 1)); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/TypeSafeMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/TypeSafeMatcherTest.java index 5563fabc..2c62da36 100644 --- a/hamcrest/src/test/java/org/hamcrest/TypeSafeMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/TypeSafeMatcherTest.java @@ -38,4 +38,5 @@ public void describeTo(Description description) { assertMismatchDescription("was a java.lang.Integer (<3>)", (Matcher)matcher, 3); assertMismatchDescription("The mismatch", matcher, "a string"); } + } From c8f5c5eb6579e5c5080c0c13cb76570464366724 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:46:50 +0000 Subject: [PATCH 16/54] Java Code Style EOF org.hamcrest.beans --- hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java | 1 + hamcrest/src/test/java/org/hamcrest/beans/HasPropertyTest.java | 1 + .../test/java/org/hamcrest/beans/HasPropertyWithValueTest.java | 1 + .../test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java | 1 + 4 files changed, 4 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java b/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java index 99f933ea..bd4f2c03 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java @@ -52,4 +52,5 @@ public static PropertyDescriptor[] propertyDescriptorsFor(Object fromObj, Class< } public static final Object[] NO_ARGUMENTS = new Object[0]; + } diff --git a/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyTest.java b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyTest.java index 11813106..449a1f90 100644 --- a/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyTest.java +++ b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyTest.java @@ -45,4 +45,5 @@ public final class HasPropertyTest { assertMismatchDescription("no \"aNonExistentProp\" in <[Person: a bean]>", hasProperty("aNonExistentProp"), bean); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java index d5f427e6..069d8567 100644 --- a/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java +++ b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java @@ -181,4 +181,5 @@ public String getBroken() { public static class BeanFailed extends RuntimeException { public BeanFailed() { super("bean failed"); } } + } diff --git a/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java b/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java index caecb684..844bb911 100644 --- a/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java +++ b/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java @@ -128,4 +128,5 @@ public SubBeanWithExtraProperty(String stringProperty, int intProperty, Value va @SuppressWarnings("unused") public String getExtraProperty() { return "extra"; } } + } From 83801b6773c86c948fc545d96b498cff98a707b2 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:48:41 +0000 Subject: [PATCH 17/54] Java Code Style EOF org.hamcrest.collection --- .../java/org/hamcrest/collection/ArrayAsIterableMatcher.java | 1 + .../src/main/java/org/hamcrest/collection/ArrayMatching.java | 2 +- .../org/hamcrest/collection/IsArrayContainingInAnyOrder.java | 1 + .../java/org/hamcrest/collection/IsArrayContainingInOrder.java | 1 + .../src/main/java/org/hamcrest/collection/IsArrayWithSize.java | 1 + .../main/java/org/hamcrest/collection/IsEmptyCollection.java | 1 + .../src/main/java/org/hamcrest/collection/IsEmptyIterable.java | 1 + hamcrest/src/main/java/org/hamcrest/collection/IsIn.java | 1 + .../org/hamcrest/collection/IsIterableContainingInAnyOrder.java | 2 +- .../org/hamcrest/collection/IsIterableContainingInOrder.java | 1 + .../collection/IsIterableContainingInRelativeOrder.java | 1 + .../main/java/org/hamcrest/collection/IsIterableWithSize.java | 1 + .../src/main/java/org/hamcrest/collection/IsMapContaining.java | 1 + .../src/main/java/org/hamcrest/collection/IsMapWithSize.java | 1 + .../org/hamcrest/collection/ArrayMatchingInAnyOrderTest.java | 1 + .../java/org/hamcrest/collection/ArrayMatchingInOrderTest.java | 1 + .../hamcrest/collection/IsArrayContainingInAnyOrderTest.java | 1 + .../org/hamcrest/collection/IsArrayContainingInOrderTest.java | 1 + hamcrest/src/test/java/org/hamcrest/collection/IsArrayTest.java | 1 + .../test/java/org/hamcrest/collection/IsArrayWithSizeTest.java | 1 + .../java/org/hamcrest/collection/IsCollectionWithSizeTest.java | 1 + .../java/org/hamcrest/collection/IsEmptyCollectionTest.java | 1 + .../test/java/org/hamcrest/collection/IsEmptyIterableTest.java | 1 + hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java | 1 + .../hamcrest/collection/IsIterableContainingInAnyOrderTest.java | 1 + .../hamcrest/collection/IsIterableContainingInOrderTest.java | 1 + .../collection/IsIterableContainingInRelativeOrderTest.java | 1 + .../java/org/hamcrest/collection/IsIterableWithSizeTest.java | 1 + .../java/org/hamcrest/collection/IsMapContainingKeyTest.java | 1 + .../test/java/org/hamcrest/collection/IsMapContainingTest.java | 1 + .../java/org/hamcrest/collection/IsMapContainingValueTest.java | 1 + .../test/java/org/hamcrest/collection/IsMapWithSizeTest.java | 1 + 32 files changed, 32 insertions(+), 2 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/collection/ArrayAsIterableMatcher.java b/hamcrest/src/main/java/org/hamcrest/collection/ArrayAsIterableMatcher.java index a841a2c9..ddeded7c 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/ArrayAsIterableMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/ArrayAsIterableMatcher.java @@ -42,4 +42,5 @@ public void describeTo(Description description) { description.appendList("[", ", ", "]", matchers) .appendText(" ").appendText(message); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java b/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java index 59811ff1..c800b50e 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java @@ -195,5 +195,5 @@ public static List> asEqualMatchers(E[] items) { } return matchers; } -} +} diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java index 162156b4..c0002253 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java @@ -115,4 +115,5 @@ public static Matcher arrayContainingInAnyOrder(E... items) { } return new IsArrayContainingInAnyOrder(matchers); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java index 6e46d472..63a12cf1 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java @@ -98,4 +98,5 @@ public static Matcher arrayContaining(Matcher... itemMatcher public static Matcher arrayContaining(List> itemMatchers) { return new IsArrayContainingInOrder(itemMatchers); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java index b4441437..00c0f1a4 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java @@ -63,4 +63,5 @@ public static Matcher arrayWithSize(int size) { public static Matcher emptyArray() { return describedAs("an empty array", IsArrayWithSize.arrayWithSize(0)); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java index 7a07360a..e453744c 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java @@ -56,4 +56,5 @@ public static Matcher> empty() { public static Matcher> emptyCollectionOf(Class unusedToForceReturnType) { return (Matcher)empty(); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java index 4173ac3a..a0097600 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java @@ -51,4 +51,5 @@ public static Matcher> emptyIterable() { public static Matcher> emptyIterableOf(Class unusedToForceReturnType) { return (Matcher)emptyIterable(); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java index 0a259149..046e744f 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java @@ -133,4 +133,5 @@ public static Matcher isOneOf(T... elements) { public static Matcher oneOf(T... elements) { return in(elements); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java index 975e44df..9a24deca 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java @@ -161,5 +161,5 @@ public static Matcher> containsInAnyOrder(T... items) public static Matcher> containsInAnyOrder(Collection> itemMatchers) { return new IsIterableContainingInAnyOrder<>(itemMatchers); } -} +} diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java index d7736c11..0b5b2058 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java @@ -159,4 +159,5 @@ public static Matcher> contains(Matcher... public static Matcher> contains(List> itemMatchers) { return new IsIterableContainingInOrder<>(itemMatchers); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java index 7ed7f2e2..34233cf9 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java @@ -125,4 +125,5 @@ public static Matcher> containsInRelativeOrder(Matcher public static Matcher> containsInRelativeOrder(List> itemMatchers) { return new IsIterableContainingInRelativeOrder<>(itemMatchers); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java index 95d53b4f..430cb2ef 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java @@ -56,4 +56,5 @@ public static Matcher> iterableWithSize(Matcher public static Matcher> iterableWithSize(int size) { return iterableWithSize(equalTo(size)); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java b/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java index ac9d473f..a6eb8be4 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java @@ -148,4 +148,5 @@ public static Matcher> hasEntry(K key, V valu public static Matcher> hasValue(V value) { return new IsMapContaining<>(anything(), equalTo(value)); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java index 9821d720..480d7b91 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java @@ -72,4 +72,5 @@ protected Integer featureValueOf(Map actual) { public static Matcher> anEmptyMap() { return IsMapWithSize.aMapWithSize(equalTo(0)); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInAnyOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInAnyOrderTest.java index be4d3f1e..8984facf 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInAnyOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInAnyOrderTest.java @@ -39,4 +39,5 @@ public void testMismatchesItemsInAnyOrder() { assertMismatchDescription("no item matches: <2>, <3> in [<1>]", matcher, new Integer[] {1}); assertMismatchDescription("not matched: <4>", matcher, new Integer[] {4,3,2,1}); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInOrderTest.java index 784817a0..6c9d0c91 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInOrderTest.java @@ -42,4 +42,5 @@ public void testMismatchesItemsInOrder() { public void testCanHandleNullValuesInAnArray() { assertMatches("with nulls", arrayContaining(null, null), new Object[]{null, null}); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java index 01d9e3de..2f59d997 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java @@ -40,4 +40,5 @@ public void testMismatchesItemsInAnyOrder() { assertMismatchDescription("no item matches: <2>, <3> in [<1>]", matcher, new Integer[] {1}); assertMismatchDescription("not matched: <4>", matcher, new Integer[] {4,3,2,1}); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java index b719dd14..f1ba6571 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java @@ -38,4 +38,5 @@ public void testMismatchesItemsInOrder() { assertMismatchDescription("item 0: was <4>", matcher, new Integer[] {4,3,2,1}); assertMismatchDescription("item 2: was <4>", matcher, new Integer[] {1,2, 4}); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsArrayTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayTest.java index 4135d9f5..1cb9cbb7 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsArrayTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayTest.java @@ -56,4 +56,5 @@ public void testHasAReadableMismatchDescriptionUsingCustomMatchers() { }; assertMismatchDescription("element <0> didn't match", array(m, equalTo("b")), new String[]{"c", "b"}); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsArrayWithSizeTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayWithSizeTest.java index 18f607ec..051021a9 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsArrayWithSizeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayWithSizeTest.java @@ -33,4 +33,5 @@ public void testHasAReadableDescription() { assertDescription("an array with size <3>", arrayWithSize(equalTo(3))); assertDescription("an empty array", emptyArray()); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java index b04a0c5c..f19f2140 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java @@ -74,4 +74,5 @@ public void testCompilesWithATypedCollection() { ArrayList arrayList = new ArrayList(); MatcherAssert.assertThat(arrayList, hasSize(0)); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyCollectionTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyCollectionTest.java index ea875e8a..513e2eba 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyCollectionTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyCollectionTest.java @@ -42,4 +42,5 @@ private static Collection collectionOfValues() { private static Collection emptyCollection() { return new ArrayList(); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyIterableTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyIterableTest.java index 600b5760..5689d906 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyIterableTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyIterableTest.java @@ -41,4 +41,5 @@ private static Collection collectionOfValues() { private static Collection emptyCollection() { return new ArrayList(); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java index e9fcbdcb..65331926 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java @@ -41,4 +41,5 @@ public void testHasReadableDescription() { "one of {\"a\", \"b\", \"c\"}", StringDescription.toString(isIn)); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java index 091c3475..63c3b1f5 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java @@ -51,4 +51,5 @@ public void testDoesNotMatchIfThereAreMoreMatchersThanElements() { public void testHasAReadableDescription() { assertDescription("iterable with items [<1>, <2>] in any order", containsInAnyOrder(1, 2)); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java index 23cecf10..410baaf4 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java @@ -73,4 +73,5 @@ public static Matcher value(int value) { @Override protected Integer featureValueOf(WithValue actual) { return actual.getValue(); } }; } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInRelativeOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInRelativeOrderTest.java index 8192c8bf..243947f1 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInRelativeOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInRelativeOrderTest.java @@ -90,4 +90,5 @@ public static Matcher value(int value) { @Override protected Integer featureValueOf(WithValue actual) { return actual.getValue(); } }; } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableWithSizeTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableWithSizeTest.java index 8bf65d14..c4ffd365 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableWithSizeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableWithSizeTest.java @@ -34,4 +34,5 @@ public void testDoesNotMatchIncorrectSize() throws Exception { public void testHasAReadableDescription() { assertDescription("an iterable with size <4>", iterableWithSize(4)); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java index 13f067c8..1e89c2d9 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java @@ -81,4 +81,5 @@ public void testDoesNotMatchMapMissingKey() { assertMismatchDescription("map was [, , ]", hasKey("d"), map); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingTest.java index 3eed3463..2f9e0880 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingTest.java @@ -46,4 +46,5 @@ public void testDoesNotMatchNull() { public void testHasReadableDescription() { assertDescription("map containing [\"a\"-><2>]", hasEntry(equalTo("a"), (equalTo(2)))); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java index a2d7f908..96383add 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java @@ -43,4 +43,5 @@ public void testMatchesMapContainingValue() { assertMatches("hasValue 3", hasValue(3), map); assertMismatchDescription("map was [, , ]", hasValue(4), map); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java index c050924c..e9966513 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java @@ -79,4 +79,5 @@ private static Map mapWithKeys(K... keys) { } return result; } + } From 11370fe2e18d8dd4452eff85f5dd49192ed74335 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:48:41 +0000 Subject: [PATCH 18/54] Java Code Style EOF org.hamcrest.comparator --- .../java/org/hamcrest/comparator/ComparatorMatcherBuilder.java | 1 + .../org/hamcrest/comparator/ComparatorMatcherBuilderTest.java | 1 + .../test/java/org/hamcrest/comparator/ComparatorMatcherTest.java | 1 + 3 files changed, 3 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java b/hamcrest/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java index 13a0db64..520def1b 100644 --- a/hamcrest/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java +++ b/hamcrest/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java @@ -190,4 +190,5 @@ public Matcher lessThan(T value) { public Matcher lessThanOrEqualTo(T value) { return new ComparatorMatcher(comparator, value, ComparatorMatcher.LESS_THAN, ComparatorMatcher.EQUAL, includeComparatorInDescription); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherBuilderTest.java b/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherBuilderTest.java index a5fdb4ac..40cb3457 100644 --- a/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherBuilderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherBuilderTest.java @@ -125,4 +125,5 @@ public int compareTo(CustomInt other) { return value - other.value; } } + } diff --git a/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherTest.java index 2bc53d4c..5dcf5b3d 100644 --- a/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherTest.java @@ -84,4 +84,5 @@ public int compareTo(CustomInt other) { return value - other.value; } } + } From 0dec0844fd0eccf276560ff4457e9802cafab444 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:48:42 +0000 Subject: [PATCH 19/54] Java Code Style EOF org.hamcrest.core --- hamcrest/src/main/java/org/hamcrest/core/AllOf.java | 1 + hamcrest/src/main/java/org/hamcrest/core/AnyOf.java | 1 + hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java | 1 + hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java | 1 + hamcrest/src/main/java/org/hamcrest/core/Every.java | 1 + hamcrest/src/main/java/org/hamcrest/core/Is.java | 1 + hamcrest/src/main/java/org/hamcrest/core/IsAnything.java | 1 + hamcrest/src/main/java/org/hamcrest/core/IsEqual.java | 1 + hamcrest/src/main/java/org/hamcrest/core/IsNot.java | 1 + hamcrest/src/main/java/org/hamcrest/core/IsNull.java | 2 +- hamcrest/src/main/java/org/hamcrest/core/IsSame.java | 1 + .../src/main/java/org/hamcrest/core/ShortcutCombination.java | 1 + .../main/java/org/hamcrest/core/StringRegularExpression.java | 1 + hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java | 1 + hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java | 1 + hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java | 1 + hamcrest/src/test/java/org/hamcrest/core/DescribedAsTest.java | 1 + hamcrest/src/test/java/org/hamcrest/core/EveryTest.java | 2 +- .../test/java/org/hamcrest/core/IsCollectionContainingTest.java | 2 +- hamcrest/src/test/java/org/hamcrest/core/IsEqualTest.java | 2 +- hamcrest/src/test/java/org/hamcrest/core/IsInstanceOfTest.java | 2 +- .../test/java/org/hamcrest/core/IsIterableContainingTest.java | 2 +- hamcrest/src/test/java/org/hamcrest/core/IsNotTest.java | 1 + hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java | 1 + hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java | 1 + hamcrest/src/test/java/org/hamcrest/core/IsTest.java | 1 + hamcrest/src/test/java/org/hamcrest/core/SampleBaseClass.java | 1 + .../src/test/java/org/hamcrest/core/StringContainsTest.java | 1 - .../java/org/hamcrest/core/StringRegularExpressionTest.java | 1 + 29 files changed, 28 insertions(+), 7 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/core/AllOf.java b/hamcrest/src/main/java/org/hamcrest/core/AllOf.java index ff65f263..d4efdb99 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/AllOf.java +++ b/hamcrest/src/main/java/org/hamcrest/core/AllOf.java @@ -70,4 +70,5 @@ public static Matcher allOf(Iterable> matchers) { public static Matcher allOf(Matcher... matchers) { return allOf(Arrays.asList(matchers)); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java b/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java index 116f63a8..20db6679 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java +++ b/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java @@ -60,4 +60,5 @@ public static AnyOf anyOf(Iterable> matchers) { public static AnyOf anyOf(Matcher... matchers) { return anyOf(Arrays.asList(matchers)); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java b/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java index f90e7d55..b748793b 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java @@ -96,4 +96,5 @@ public CombinableMatcher or(Matcher other) { return new CombinableMatcher<>(first).or(other); } } + } diff --git a/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java b/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java index 1bcb4c89..2471775f 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java +++ b/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java @@ -69,4 +69,5 @@ public void describeMismatch(Object item, Description description) { public static Matcher describedAs(String description, Matcher matcher, Object... values) { return new DescribedAs(description, matcher, values); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/core/Every.java b/hamcrest/src/main/java/org/hamcrest/core/Every.java index b7099a71..14997516 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/Every.java +++ b/hamcrest/src/main/java/org/hamcrest/core/Every.java @@ -44,4 +44,5 @@ public void describeTo(Description description) { public static Matcher> everyItem(final Matcher itemMatcher) { return new Every<>(itemMatcher); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/core/Is.java b/hamcrest/src/main/java/org/hamcrest/core/Is.java index 5f5716dc..1a92955b 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/Is.java +++ b/hamcrest/src/main/java/org/hamcrest/core/Is.java @@ -86,4 +86,5 @@ public static Matcher is(T value) { public static Matcher isA(Class type) { return is(IsInstanceOf.instanceOf(type)); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsAnything.java b/hamcrest/src/main/java/org/hamcrest/core/IsAnything.java index 8a08d3af..b40ecaf2 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsAnything.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsAnything.java @@ -48,4 +48,5 @@ public void describeTo(Description description) { public static Matcher anything(String description) { return new IsAnything<>(description); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java b/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java index 5b90edca..7a2a1bf5 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java @@ -103,4 +103,5 @@ public static Matcher equalTo(T operand) { public static Matcher equalToObject(Object operand) { return new IsEqual<>(operand); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsNot.java b/hamcrest/src/main/java/org/hamcrest/core/IsNot.java index 4973e377..2f4d88a2 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsNot.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsNot.java @@ -60,4 +60,5 @@ public static Matcher not(Matcher matcher) { public static Matcher not(T value) { return not(equalTo(value)); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsNull.java b/hamcrest/src/main/java/org/hamcrest/core/IsNull.java index 71a82abb..07045c91 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsNull.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsNull.java @@ -77,5 +77,5 @@ public static Matcher nullValue(Class type) { public static Matcher notNullValue(Class type) { return not(nullValue(type)); } -} +} diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsSame.java b/hamcrest/src/main/java/org/hamcrest/core/IsSame.java index 7c4e3685..8f24de8d 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsSame.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsSame.java @@ -54,4 +54,5 @@ public static Matcher sameInstance(T target) { public static Matcher theInstance(T target) { return new IsSame(target); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/core/ShortcutCombination.java b/hamcrest/src/main/java/org/hamcrest/core/ShortcutCombination.java index 30b33af5..7b4daf03 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/ShortcutCombination.java +++ b/hamcrest/src/main/java/org/hamcrest/core/ShortcutCombination.java @@ -30,4 +30,5 @@ protected boolean matches(Object o, boolean shortcut) { public void describeTo(Description description, String operator) { description.appendList("(", " " + operator + " ", ")", matchers); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/core/StringRegularExpression.java b/hamcrest/src/main/java/org/hamcrest/core/StringRegularExpression.java index b893ff0e..55c4ecb6 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/StringRegularExpression.java +++ b/hamcrest/src/main/java/org/hamcrest/core/StringRegularExpression.java @@ -65,4 +65,5 @@ public static Matcher matchesRegex(Pattern pattern) { public static Matcher matchesRegex(String regex) { return matchesRegex(Pattern.compile(regex)); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java b/hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java index 0387207c..ddc1567a 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java @@ -67,4 +67,5 @@ public final class AllOfTest { varargs(){ assertThat("the text!", new AllOf<>(startsWith("the"), containsString("text"), endsWith("!"))); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java b/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java index e2d9a9ee..480cddcb 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java @@ -59,4 +59,5 @@ public final class AnyOfTest { varargs(){ assertThat("the text!", new AnyOf<>(startsWith("the"), endsWith("."))); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java b/hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java index 7a209b62..86e8805c 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java @@ -65,4 +65,5 @@ public final class CombinableTest { @SuppressWarnings("unused") Matcher matcher = CombinableMatcher.both(equalTo("yellow")).and(notNullValue(String.class)); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/core/DescribedAsTest.java b/hamcrest/src/test/java/org/hamcrest/core/DescribedAsTest.java index 5c76af90..fffc83bc 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/DescribedAsTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/DescribedAsTest.java @@ -46,4 +46,5 @@ public final class DescribedAsTest { assertMismatchDescription("was <1>", matcher, 1); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/core/EveryTest.java b/hamcrest/src/test/java/org/hamcrest/core/EveryTest.java index ff9f1772..49f5f274 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/EveryTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/EveryTest.java @@ -40,5 +40,5 @@ public final class EveryTest { describesAMismatch() { assertMismatchDescription("an item was \"BXB\"", matcher, singletonList("BXB")); } -} +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java index db76bb1d..5616ed8a 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java @@ -99,5 +99,5 @@ public void describeTo(Description description) { } }; } -} +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsEqualTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsEqualTest.java index d3ff21c5..a0c692a6 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsEqualTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsEqualTest.java @@ -153,5 +153,5 @@ public String toString() { returnsGoodDescriptionIfCreatedWithNullReference() { assertDescription("null", equalTo(null)); } -} +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsInstanceOfTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsInstanceOfTest.java index 8dd85af1..39af41e7 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsInstanceOfTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsInstanceOfTest.java @@ -65,5 +65,5 @@ public final class IsInstanceOfTest { private static T with(@SuppressWarnings("unused") Matcher matcher) { return null; } -} +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java index 02148b81..c4baba9d 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java @@ -103,5 +103,5 @@ public void describeTo(Description description) { } }; } -} +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsNotTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsNotTest.java index 79f46837..a9160a52 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsNotTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsNotTest.java @@ -39,4 +39,5 @@ public final class IsNotTest { assertDescription("not an instance of java.lang.String", not(instanceOf(String.class))); assertDescription("not \"A\"", not("A")); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java index 74b046b5..8366951c 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java @@ -40,4 +40,5 @@ public final class IsNullTest { private void requiresStringMatcher(@SuppressWarnings("unused") Matcher arg) { // no-op } + } diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java index a4a20105..9f8bcf3d 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java @@ -45,4 +45,5 @@ public final class IsSameTest { returnsReadableDescriptionFromToStringWhenInitialisedWithNull() { assertDescription("sameInstance(null)", sameInstance(null)); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsTest.java index d5220bde..af60135c 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsTest.java @@ -48,4 +48,5 @@ public final class IsTest { assertDoesNotMatch(matcher, new Object()); assertDoesNotMatch(matcher, null); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/core/SampleBaseClass.java b/hamcrest/src/test/java/org/hamcrest/core/SampleBaseClass.java index baf4d8e9..29fa0186 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/SampleBaseClass.java +++ b/hamcrest/src/test/java/org/hamcrest/core/SampleBaseClass.java @@ -21,4 +21,5 @@ public boolean equals(Object obj) { public int hashCode() { return value.hashCode(); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java index 1fc269ef..5b5a166a 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java @@ -41,5 +41,4 @@ public void testMatchesSubstringsIgnoringCase() { assertDescription("a string containing \"ExCert\" ignoring case", ignoringCase); } - } diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringRegularExpressionTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringRegularExpressionTest.java index 2b2991bf..cf6be000 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/StringRegularExpressionTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/StringRegularExpressionTest.java @@ -22,4 +22,5 @@ public void testMatchingRegex() { assertDescription("a string matching the pattern <^[0-9]+$>", matcher); assertMismatchDescription("the string was \"bcd\"", matcher, "bcd"); } + } From c8ff2569cba39d35bdedab34e5fe1bd4207a8ec9 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:48:42 +0000 Subject: [PATCH 20/54] Java Code Style EOF org.hamcrest.number --- .../src/main/java/org/hamcrest/number/BigDecimalCloseTo.java | 1 - hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java | 1 + hamcrest/src/main/java/org/hamcrest/number/IsNaN.java | 1 + .../src/main/java/org/hamcrest/number/OrderingComparison.java | 1 + hamcrest/src/test/java/org/hamcrest/number/IsNanTest.java | 1 + .../test/java/org/hamcrest/number/OrderingComparisonTest.java | 1 + 6 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hamcrest/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java b/hamcrest/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java index 4862f30c..4d997c7f 100644 --- a/hamcrest/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java +++ b/hamcrest/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java @@ -61,4 +61,3 @@ public static Matcher closeTo(BigDecimal operand, BigDecimal error) } } - diff --git a/hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java b/hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java index cc6b74bb..6c5c9886 100644 --- a/hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java +++ b/hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java @@ -61,4 +61,5 @@ private double actualDelta(Double item) { public static Matcher closeTo(double operand, double error) { return new IsCloseTo(operand, error); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/number/IsNaN.java b/hamcrest/src/main/java/org/hamcrest/number/IsNaN.java index 31fcdf82..716c3f1e 100644 --- a/hamcrest/src/main/java/org/hamcrest/number/IsNaN.java +++ b/hamcrest/src/main/java/org/hamcrest/number/IsNaN.java @@ -37,4 +37,5 @@ public void describeTo(Description description) { public static Matcher notANumber() { return new IsNaN(); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/number/OrderingComparison.java b/hamcrest/src/main/java/org/hamcrest/number/OrderingComparison.java index 42493140..c450e22a 100644 --- a/hamcrest/src/main/java/org/hamcrest/number/OrderingComparison.java +++ b/hamcrest/src/main/java/org/hamcrest/number/OrderingComparison.java @@ -91,4 +91,5 @@ public static > Matcher lessThan(T value) { public static > Matcher lessThanOrEqualTo(T value) { return ComparatorMatcherBuilder.usingNaturalOrdering().lessThanOrEqualTo(value); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/number/IsNanTest.java b/hamcrest/src/test/java/org/hamcrest/number/IsNanTest.java index c9b39568..b830b4b3 100644 --- a/hamcrest/src/test/java/org/hamcrest/number/IsNanTest.java +++ b/hamcrest/src/test/java/org/hamcrest/number/IsNanTest.java @@ -40,4 +40,5 @@ public final class IsNanTest { describesAMismatch() { assertMismatchDescription("was <1.25>", notANumber(), 1.25); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/number/OrderingComparisonTest.java b/hamcrest/src/test/java/org/hamcrest/number/OrderingComparisonTest.java index 5953bd0b..6e430a4d 100644 --- a/hamcrest/src/test/java/org/hamcrest/number/OrderingComparisonTest.java +++ b/hamcrest/src/test/java/org/hamcrest/number/OrderingComparisonTest.java @@ -77,4 +77,5 @@ public int compareTo(CustomInt other) { return value - other.value; } } + } From 9300b5005de4ca09d31080d78037230dd12e118f Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:48:42 +0000 Subject: [PATCH 21/54] Java Code Style EOF org.hamcrest.object --- hamcrest/src/main/java/org/hamcrest/object/HasEqualValues.java | 1 - hamcrest/src/main/java/org/hamcrest/object/HasToString.java | 1 + hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java | 1 + hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java | 1 + .../src/test/java/org/hamcrest/object/HasEqualsValuesTest.java | 1 + hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java | 1 + .../src/test/java/org/hamcrest/object/IsCompatibleTypeTest.java | 1 + hamcrest/src/test/java/org/hamcrest/object/IsEventFromTest.java | 1 + .../src/test/java/org/hamcrest/object/MatchesPatternTest.java | 1 + 9 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hamcrest/src/main/java/org/hamcrest/object/HasEqualValues.java b/hamcrest/src/main/java/org/hamcrest/object/HasEqualValues.java index cffea890..fb871a5f 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/HasEqualValues.java +++ b/hamcrest/src/main/java/org/hamcrest/object/HasEqualValues.java @@ -82,5 +82,4 @@ private static Object uncheckedGet(Field field, Object object) { } } - } diff --git a/hamcrest/src/main/java/org/hamcrest/object/HasToString.java b/hamcrest/src/main/java/org/hamcrest/object/HasToString.java index 778faa54..c6331548 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/HasToString.java +++ b/hamcrest/src/main/java/org/hamcrest/object/HasToString.java @@ -46,4 +46,5 @@ public static Matcher hasToString(Matcher toStringMatcher public static Matcher hasToString(String expectedToString) { return new HasToString(equalTo(expectedToString)); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java b/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java index 67793b3f..5d7ddd24 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java +++ b/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java @@ -41,4 +41,5 @@ public void describeTo(Description description) { public static Matcher> typeCompatibleWith(Class baseType) { return new IsCompatibleType(baseType); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java b/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java index 784acf39..101abba1 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java +++ b/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java @@ -75,4 +75,5 @@ public static Matcher eventFrom(Class eventC public static Matcher eventFrom(Object source) { return eventFrom(EventObject.class, source); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/object/HasEqualsValuesTest.java b/hamcrest/src/test/java/org/hamcrest/object/HasEqualsValuesTest.java index 44aa7619..f6cfaed3 100644 --- a/hamcrest/src/test/java/org/hamcrest/object/HasEqualsValuesTest.java +++ b/hamcrest/src/test/java/org/hamcrest/object/HasEqualsValuesTest.java @@ -53,4 +53,5 @@ public Parent(char c) { this.c = c; } } + } diff --git a/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java b/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java index 122e19b5..1ba0be15 100644 --- a/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java +++ b/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java @@ -52,4 +52,5 @@ public String toString() { String expectedMismatchString = "toString() was \"Cheese\""; assertMismatchDescription(expectedMismatchString, matcher, "Cheese"); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/object/IsCompatibleTypeTest.java b/hamcrest/src/test/java/org/hamcrest/object/IsCompatibleTypeTest.java index 62a3637c..a90c4931 100644 --- a/hamcrest/src/test/java/org/hamcrest/object/IsCompatibleTypeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/object/IsCompatibleTypeTest.java @@ -50,4 +50,5 @@ public void testMatchesExtendedInterface() { public void testHasReadableDescription() { assertDescription("type < java.lang.Runnable", typeCompatibleWith(Runnable.class)); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/object/IsEventFromTest.java b/hamcrest/src/test/java/org/hamcrest/object/IsEventFromTest.java index b3c4a3a5..98ab4dea 100644 --- a/hamcrest/src/test/java/org/hamcrest/object/IsEventFromTest.java +++ b/hamcrest/src/test/java/org/hamcrest/object/IsEventFromTest.java @@ -49,4 +49,5 @@ public void testCanTestForSpecificEventClasses() { assertMismatchDescription("item type was java.util.EventObject", isEventMatcher, wrongType); assertMismatchDescription("item type was java.util.EventObject", isEventMatcher, wrongSourceAndType); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/object/MatchesPatternTest.java b/hamcrest/src/test/java/org/hamcrest/object/MatchesPatternTest.java index 3e2d9114..6e2ceb97 100644 --- a/hamcrest/src/test/java/org/hamcrest/object/MatchesPatternTest.java +++ b/hamcrest/src/test/java/org/hamcrest/object/MatchesPatternTest.java @@ -56,4 +56,5 @@ public void factoryMethodAllowsCreationWithString() { Matcher m = MatchesPattern.matchesPattern("a[bc](d|e)"); assertDescription("a string matching the pattern 'a[bc](d|e)'", m ); } + } From 8a2b3b69510b6335530c9035f2bc2b65a4aea4c4 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:48:42 +0000 Subject: [PATCH 22/54] Java Code Style EOF org.hamcrest.text --- .../src/main/java/org/hamcrest/text/CharSequenceLength.java | 3 +-- hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java | 1 + hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java | 1 + hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java | 1 + .../src/main/java/org/hamcrest/text/StringContainsInOrder.java | 1 + .../src/test/java/org/hamcrest/text/IsBlankStringTest.java | 1 + .../src/test/java/org/hamcrest/text/IsEmptyStringTest.java | 1 + .../org/hamcrest/text/IsEqualCompressingWhiteSpaceTest.java | 1 + .../test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java | 1 + .../test/java/org/hamcrest/text/StringContainsInOrderTest.java | 1 + 10 files changed, 10 insertions(+), 2 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/text/CharSequenceLength.java b/hamcrest/src/main/java/org/hamcrest/text/CharSequenceLength.java index 111a1e7d..496d3fec 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/CharSequenceLength.java +++ b/hamcrest/src/main/java/org/hamcrest/text/CharSequenceLength.java @@ -54,6 +54,5 @@ public static Matcher hasLength(int length) { public static Matcher hasLength(Matcher lengthMatcher) { return new CharSequenceLength(lengthMatcher); } -} - +} diff --git a/hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java b/hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java index 19a9ec3c..9dae9205 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java +++ b/hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java @@ -55,4 +55,5 @@ public static Matcher blankString() { public static Matcher blankOrNullString() { return NULL_OR_BLANK_INSTANCE; } + } diff --git a/hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java b/hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java index 8fdf0bb5..06011cc3 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java +++ b/hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java @@ -77,4 +77,5 @@ public static Matcher isEmptyOrNullString() { public static Matcher emptyOrNullString() { return NULL_OR_EMPTY_INSTANCE; } + } diff --git a/hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java b/hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java index a54a793d..28c5a48d 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java +++ b/hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java @@ -46,4 +46,5 @@ public static Matcher matchesPattern(Pattern pattern) { public static Matcher matchesPattern(String regex) { return new MatchesPattern(Pattern.compile(regex)); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/text/StringContainsInOrder.java b/hamcrest/src/main/java/org/hamcrest/text/StringContainsInOrder.java index e95b8ee9..43152dee 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/StringContainsInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/text/StringContainsInOrder.java @@ -69,4 +69,5 @@ public static Matcher stringContainsInOrder(Iterable substrings) public static Matcher stringContainsInOrder(String... substrings) { return new StringContainsInOrder(Arrays.asList(substrings)); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/text/IsBlankStringTest.java b/hamcrest/src/test/java/org/hamcrest/text/IsBlankStringTest.java index c5f35f1c..0ce043cd 100644 --- a/hamcrest/src/test/java/org/hamcrest/text/IsBlankStringTest.java +++ b/hamcrest/src/test/java/org/hamcrest/text/IsBlankStringTest.java @@ -52,4 +52,5 @@ public final class IsBlankStringTest { assertMismatchDescription("was \"a\"", blankString(), "a"); assertMismatchDescription("was \"a\"", blankOrNullString(), "a"); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/text/IsEmptyStringTest.java b/hamcrest/src/test/java/org/hamcrest/text/IsEmptyStringTest.java index 62e30535..a5139bd8 100644 --- a/hamcrest/src/test/java/org/hamcrest/text/IsEmptyStringTest.java +++ b/hamcrest/src/test/java/org/hamcrest/text/IsEmptyStringTest.java @@ -52,4 +52,5 @@ public final class IsEmptyStringTest { assertMismatchDescription("was \"a\"", emptyString(), "a"); assertMismatchDescription("was \"a\"", emptyOrNullString(), "a"); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/text/IsEqualCompressingWhiteSpaceTest.java b/hamcrest/src/test/java/org/hamcrest/text/IsEqualCompressingWhiteSpaceTest.java index e85e54f6..bbd8af73 100644 --- a/hamcrest/src/test/java/org/hamcrest/text/IsEqualCompressingWhiteSpaceTest.java +++ b/hamcrest/src/test/java/org/hamcrest/text/IsEqualCompressingWhiteSpaceTest.java @@ -45,4 +45,5 @@ public void testHasAReadableDescription() { public void testPassesIfWhitespacesContainsNoBreakSpace() { assertMatches(matcher, "Hello" + ((char)160) + "World how are we?"); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java b/hamcrest/src/test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java index b2b73917..3763b348 100644 --- a/hamcrest/src/test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java +++ b/hamcrest/src/test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java @@ -59,4 +59,5 @@ public final class IsEqualIgnoringCaseTest { String expectedMismatchString = "was \"Cheese\""; assertMismatchDescription(expectedMismatchString, matcher, "Cheese"); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java index 52390a82..86d3df8b 100644 --- a/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java @@ -30,4 +30,5 @@ public void testMatchesOnlyIfStringContainsGivenSubstringsInTheSameOrder() { public void testHasAReadableDescription() { assertDescription("a string containing \"a\", \"b\", \"c\", \"c\" in order", matcher); } + } From d150c7498ea4be2a7731f50276d21dff5928a47a Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:48:42 +0000 Subject: [PATCH 23/54] Java Code Style EOF org.hamcrest.xml --- hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java | 1 + hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java | 1 + 2 files changed, 2 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java b/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java index b4a2c80c..9e26ee4f 100644 --- a/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java +++ b/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java @@ -170,4 +170,5 @@ public static Matcher hasXPath(String xPath) { public static Matcher hasXPath(String xPath, NamespaceContext namespaceContext) { return new HasXPath(xPath, namespaceContext, WITH_ANY_CONTENT, XPathConstants.NODE); } + } diff --git a/hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java b/hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java index a66689dc..2a00f9b1 100644 --- a/hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java +++ b/hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java @@ -144,4 +144,5 @@ private static Document parse(String xml) { throw new IllegalStateException(e); } } + } From e1e1ba7abd7681a57b3d724888fe090889dc59e5 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:49:06 +0000 Subject: [PATCH 24/54] Java Code Style EOF org.hamcrest.io --- hamcrest/src/main/java/org/hamcrest/io/FileMatchers.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hamcrest/src/main/java/org/hamcrest/io/FileMatchers.java b/hamcrest/src/main/java/org/hamcrest/io/FileMatchers.java index 0b76fb14..77a26591 100644 --- a/hamcrest/src/main/java/org/hamcrest/io/FileMatchers.java +++ b/hamcrest/src/main/java/org/hamcrest/io/FileMatchers.java @@ -104,4 +104,5 @@ public void describeTo(Description description) { } }; } + } From 738f2365c684f39a0257dae1b1f0c0cef4a0e33b Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:49:40 +0000 Subject: [PATCH 25/54] Java Code Style EOF org.hamcrest.internal --- hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java | 1 + hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java | 1 + .../main/java/org/hamcrest/internal/ReflectiveTypeFinder.java | 1 + .../src/main/java/org/hamcrest/internal/SelfDescribingValue.java | 1 + .../java/org/hamcrest/internal/SelfDescribingValueIterator.java | 1 + 5 files changed, 5 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java b/hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java index 03e4c43e..5e497434 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java @@ -28,4 +28,5 @@ public Object next() { public void remove() { throw new UnsupportedOperationException("cannot remove items from an array"); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java b/hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java index 9310abfc..e5fa72f8 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java @@ -15,4 +15,5 @@ public static List> nullSafe(Matcher[] itemMat } return matchers; } + } diff --git a/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java b/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java index b06df48c..a3dfe754 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java @@ -67,4 +67,5 @@ private boolean canObtainExpectedTypeFrom(Method method) { private Class expectedTypeFrom(Method method) { return method.getParameterTypes()[typedParameter]; } + } diff --git a/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValue.java b/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValue.java index 6537018a..01bf942a 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValue.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValue.java @@ -14,4 +14,5 @@ public SelfDescribingValue(T value) { public void describeTo(Description description) { description.appendValue(value); } + } diff --git a/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java b/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java index bc8f8f43..1905ecf5 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java @@ -25,4 +25,5 @@ public SelfDescribing next() { public void remove() { values.remove(); } + } From 614c6e55ce968e0a1cb7e68dc14a6505bfcdfa25 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:50:02 +0000 Subject: [PATCH 26/54] Java Code Style EOF org.hamcrest.integration --- .../src/main/java/org/hamcrest/JMock1Matchers.java | 1 + .../src/main/java/org/hamcrest/JavaLangMatcherAssert.java | 1 + .../src/main/java/org/hamcrest/integration/EasyMock2Adapter.java | 1 + .../src/main/java/org/hamcrest/integration/JMock1Adapter.java | 1 + 4 files changed, 4 insertions(+) diff --git a/hamcrest-integration/src/main/java/org/hamcrest/JMock1Matchers.java b/hamcrest-integration/src/main/java/org/hamcrest/JMock1Matchers.java index 6aac6f87..949b1fe7 100644 --- a/hamcrest-integration/src/main/java/org/hamcrest/JMock1Matchers.java +++ b/hamcrest-integration/src/main/java/org/hamcrest/JMock1Matchers.java @@ -9,4 +9,5 @@ public class JMock1Matchers { public static Constraint equalTo(String string) { return JMock1Adapter.adapt(IsEqual.equalTo(string)); } + } diff --git a/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java b/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java index 6cc97e81..005f717e 100644 --- a/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java +++ b/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java @@ -15,4 +15,5 @@ public class JavaLangMatcherAssert { public static boolean that(T argument, Matcher matcher) { return matcher.matches(argument); } + } diff --git a/hamcrest-integration/src/main/java/org/hamcrest/integration/EasyMock2Adapter.java b/hamcrest-integration/src/main/java/org/hamcrest/integration/EasyMock2Adapter.java index f7031907..4773dc65 100644 --- a/hamcrest-integration/src/main/java/org/hamcrest/integration/EasyMock2Adapter.java +++ b/hamcrest-integration/src/main/java/org/hamcrest/integration/EasyMock2Adapter.java @@ -44,4 +44,5 @@ public boolean matches(Object argument) { public void appendTo(StringBuffer buffer) { hamcrestMatcher.describeTo(new StringDescription(buffer)); } + } diff --git a/hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java b/hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java index 86f69d8b..cf821f9f 100644 --- a/hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java +++ b/hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java @@ -43,4 +43,5 @@ public StringBuffer describeTo(StringBuffer buffer) { hamcrestMatcher.describeTo(new StringDescription(buffer)); return buffer; } + } From b2acf090626e4734da76f344d086c5ebe6601459 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:51:38 +0000 Subject: [PATCH 27/54] Java Code Style package spacing --- .../main/java/org/hamcrest/core/StringRegularExpression.java | 3 --- hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java | 1 - hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java | 1 - 3 files changed, 5 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/core/StringRegularExpression.java b/hamcrest/src/main/java/org/hamcrest/core/StringRegularExpression.java index 55c4ecb6..38ce1b1d 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/StringRegularExpression.java +++ b/hamcrest/src/main/java/org/hamcrest/core/StringRegularExpression.java @@ -1,6 +1,3 @@ -/** - * - */ package org.hamcrest.core; import java.util.regex.Pattern; diff --git a/hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java b/hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java index 9dae9205..0d02cba5 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java +++ b/hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java @@ -1,4 +1,3 @@ - package org.hamcrest.text; import org.hamcrest.Description; diff --git a/hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java b/hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java index 06011cc3..bb897f1d 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java +++ b/hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java @@ -1,4 +1,3 @@ - package org.hamcrest.text; import org.hamcrest.Description; From 34c81df9b175489adb0a1bbff591ba1a86c4d4fa Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:56:28 +0000 Subject: [PATCH 28/54] Java Code Style trailing whitespace org.hamcrest.collection --- .../org/hamcrest/collection/HasItemInArray.java | 2 +- .../main/java/org/hamcrest/collection/IsArray.java | 14 +++++++------- .../collection/IsArrayContainingInAnyOrder.java | 2 +- .../collection/IsArrayContainingInOrder.java | 2 +- .../main/java/org/hamcrest/collection/IsIn.java | 14 +++++++------- .../collection/IsIterableContainingInAnyOrder.java | 10 +++++----- .../hamcrest/collection/IsIterableWithSize.java | 2 +- .../org/hamcrest/collection/IsMapContaining.java | 2 +- .../org/hamcrest/collection/IsMapWithSize.java | 2 +- .../collection/ArrayMatchingInAnyOrderTest.java | 2 +- .../collection/ArrayMatchingInOrderTest.java | 4 ++-- .../IsArrayContainingInAnyOrderTest.java | 2 +- .../collection/IsArrayContainingInOrderTest.java | 4 ++-- .../java/org/hamcrest/collection/IsArrayTest.java | 12 ++++++------ .../collection/IsCollectionWithSizeTest.java | 2 +- .../hamcrest/collection/IsEmptyCollectionTest.java | 2 +- .../java/org/hamcrest/collection/IsInTest.java | 14 +++++++------- .../IsIterableContainingInAnyOrderTest.java | 10 +++++----- .../IsIterableContainingInOrderTest.java | 2 +- .../collection/IsMapContainingKeyTest.java | 14 +++++++------- .../collection/IsMapContainingValueTest.java | 14 +++++++------- .../org/hamcrest/collection/IsMapWithSizeTest.java | 4 ++-- 22 files changed, 68 insertions(+), 68 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/collection/HasItemInArray.java b/hamcrest/src/main/java/org/hamcrest/collection/HasItemInArray.java index 5c0513c1..112b03f7 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/HasItemInArray.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/HasItemInArray.java @@ -24,7 +24,7 @@ public HasItemInArray(Matcher elementMatcher) { public boolean matchesSafely(T[] actual) { return collectionMatcher.matches(asList(actual)); } - + @Override public void describeMismatchSafely(T[] actual, Description mismatchDescription) { collectionMatcher.describeMismatch(asList(actual), mismatchDescription); diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java index 4e7a1230..c0ed7d49 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java @@ -12,19 +12,19 @@ */ public class IsArray extends TypeSafeMatcher { private final Matcher[] elementMatchers; - + public IsArray(Matcher[] elementMatchers) { this.elementMatchers = elementMatchers.clone(); } - + @Override public boolean matchesSafely(T[] array) { if (array.length != elementMatchers.length) return false; - + for (int i = 0; i < array.length; i++) { if (!elementMatchers[i].matches(array[i])) return false; } - + return true; } @@ -46,10 +46,10 @@ public void describeMismatchSafely(T[] actual, Description mismatchDescription) @Override @SuppressWarnings("unchecked") public void describeTo(Description description) { - description.appendList(descriptionStart(), descriptionSeparator(), descriptionEnd(), + description.appendList(descriptionStart(), descriptionSeparator(), descriptionEnd(), Arrays.asList(elementMatchers)); } - + /** * Returns the string that starts the description. * @@ -85,7 +85,7 @@ protected String descriptionSeparator() { protected String descriptionEnd() { return "]"; } - + /** * 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 diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java index c0002253..d0b9a81e 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java @@ -28,7 +28,7 @@ public IsArrayContainingInAnyOrder(Collection> matchers) { public boolean matchesSafely(E[] item) { return iterableMatcher.matches(Arrays.asList(item)); } - + @Override public void describeMismatchSafely(E[] item, Description mismatchDescription) { iterableMatcher.describeMismatch(Arrays.asList(item), mismatchDescription); diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java index 63a12cf1..0d7b051b 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java @@ -27,7 +27,7 @@ public IsArrayContainingInOrder(List> matchers) { public boolean matchesSafely(E[] item) { return iterableMatcher.matches(asList(item)); } - + @Override public void describeMismatchSafely(E[] item, Description mismatchDescription) { iterableMatcher.describeMismatch(asList(item), mismatchDescription); diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java index 046e744f..f075b953 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java @@ -13,11 +13,11 @@ public class IsIn extends BaseMatcher { public IsIn(Collection collection) { this.collection = collection; } - + public IsIn(T[] elements) { collection = Arrays.asList(elements); } - + @SuppressWarnings("SuspiciousMethodCalls") @Override public boolean matches(Object o) { @@ -29,7 +29,7 @@ public void describeTo(Description buffer) { buffer.appendText("one of "); buffer.appendValueList("{", ", ", "}", collection); } - + /** * Creates a matcher that matches when the examined object is found within the * specified collection. @@ -47,7 +47,7 @@ public void describeTo(Description buffer) { public static Matcher isIn(Collection collection) { return in(collection); } - + /** * Creates a matcher that matches when the examined object is found within the * specified collection. @@ -81,7 +81,7 @@ public static Matcher in(Collection collection) { public static Matcher isIn(T[] elements) { return in(elements); } - + /** * Creates a matcher that matches when the examined object is found within the * specified array. @@ -97,7 +97,7 @@ public static Matcher isIn(T[] elements) { public static Matcher in(T[] elements) { return new IsIn<>(elements); } - + /** * Creates a matcher that matches when the examined object is equal to one of the * specified elements. @@ -116,7 +116,7 @@ public static Matcher in(T[] elements) { public static Matcher isOneOf(T... elements) { return oneOf(elements); } - + /** * Creates a matcher that matches when the examined object is equal to one of the * specified elements. diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java index 9a24deca..bb67e6f9 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java @@ -17,7 +17,7 @@ public class IsIterableContainingInAnyOrder extends TypeSafeDiagnosingMatcher public IsIterableContainingInAnyOrder(Collection> matchers) { this.matchers = matchers; } - + @Override protected boolean matchesSafely(Iterable items, Description mismatchDescription) { final Matching matching = new Matching<>(matchers, mismatchDescription); @@ -26,10 +26,10 @@ protected boolean matchesSafely(Iterable items, Description mismatc return false; } } - + return matching.isFinished(items); } - + @Override public void describeTo(Description description) { description.appendText("iterable with items ") @@ -45,7 +45,7 @@ public Matching(Collection> matchers, Description mismatchDes this.matchers = new ArrayList<>(matchers); this.mismatchDescription = mismatchDescription; } - + public boolean matches(S item) { if (matchers.isEmpty()) { mismatchDescription.appendText("no match for: ").appendValue(item); @@ -133,7 +133,7 @@ public static Matcher> containsInAnyOrder(T... items) for (T item : items) { matchers.add(equalTo(item)); } - + return new IsIterableContainingInAnyOrder<>(matchers); } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java index 430cb2ef..c0ed0120 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java @@ -12,7 +12,7 @@ public class IsIterableWithSize extends FeatureMatcher, Integer> public IsIterableWithSize(Matcher sizeMatcher) { super(sizeMatcher, "an iterable with size", "iterable size"); } - + @Override protected Integer featureValueOf(Iterable actual) { diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java b/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java index a6eb8be4..5d91acc9 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java @@ -84,7 +84,7 @@ public static Matcher> hasEntry(Matcher Matcher> hasEntry(K key, V value) { return new IsMapContaining<>(equalTo(key), equalTo(value)); } - + /** * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains * at least one key that satisfies the specified matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java index 480d7b91..b8cfbc18 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java @@ -56,7 +56,7 @@ protected Integer featureValueOf(Map actual) { public static Matcher> aMapWithSize(int size) { return IsMapWithSize.aMapWithSize(equalTo(size)); } - + /** * Creates a matcher for {@link java.util.Map}s that matches when the size() method returns * zero. diff --git a/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInAnyOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInAnyOrderTest.java index 8984facf..e2cb734c 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInAnyOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInAnyOrderTest.java @@ -18,7 +18,7 @@ public void testHasAReadableDescription() { assertDescription("[<1>, <2>] in any order", ArrayMatching.arrayContainingInAnyOrder(equalTo(1), equalTo(2))); assertDescription("[<1>, <2>] in any order", ArrayMatching.arrayContainingInAnyOrder(1, 2)); } - + public void testMatchesItemsInAnyOrder() { assertMatches("in order", ArrayMatching.arrayContainingInAnyOrder(1, 2, 3), new Integer[] {1, 2, 3}); assertMatches("out of order", ArrayMatching.arrayContainingInAnyOrder(1, 2, 3), new Integer[] {3, 2, 1}); diff --git a/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInOrderTest.java index 6c9d0c91..99db00a8 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/ArrayMatchingInOrderTest.java @@ -18,7 +18,7 @@ protected Matcher createMatcher() { public void testHasAReadableDescription() { assertDescription("[<1>, <2>]", arrayContaining(equalTo(1), equalTo(2))); } - + public void testMatchesItemsInOrder() { assertMatches("in order", arrayContaining(1, 2, 3), new Integer[] {1, 2, 3}); assertMatches("single", arrayContaining(1), new Integer[] {1}); @@ -29,7 +29,7 @@ public void testAppliesMatchersInOrder() { assertMatches("in order", arrayContaining(equalTo(1), equalTo(2), equalTo(3)), new Integer[] {1, 2, 3}); assertMatches("single", arrayContaining(equalTo(1)), new Integer[] {1}); } - + public void testMismatchesItemsInOrder() { Matcher matcher = arrayContaining(1, 2, 3); assertMismatchDescription("was null", matcher, null); diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java index 2f59d997..ce5d9931 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java @@ -19,7 +19,7 @@ public void testHasAReadableDescription() { assertDescription("[<1>, <2>] in any order", arrayContainingInAnyOrder(equalTo(1), equalTo(2))); assertDescription("[<1>, <2>] in any order", arrayContainingInAnyOrder(1, 2)); } - + public void testMatchesItemsInAnyOrder() { assertMatches("in order", arrayContainingInAnyOrder(1, 2, 3), new Integer[] {1, 2, 3}); assertMatches("out of order", arrayContainingInAnyOrder(1, 2, 3), new Integer[] {3, 2, 1}); diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java index f1ba6571..6713e687 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java @@ -18,7 +18,7 @@ protected Matcher createMatcher() { public void testHasAReadableDescription() { assertDescription("[<1>, <2>]", arrayContaining(equalTo(1), equalTo(2))); } - + public void testMatchesItemsInOrder() { assertMatches("in order", arrayContaining(1, 2, 3), new Integer[] {1, 2, 3}); assertMatches("single", arrayContaining(1), new Integer[] {1}); @@ -29,7 +29,7 @@ public void testAppliesMatchersInOrder() { assertMatches("in order", arrayContaining(equalTo(1), equalTo(2), equalTo(3)), new Integer[] {1, 2, 3}); assertMatches("single", arrayContaining(equalTo(1)), new Integer[] {1}); } - + public void testMismatchesItemsInOrder() { Matcher matcher = arrayContaining(1, 2, 3); assertMismatchDescription("was null", matcher, null); diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsArrayTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayTest.java index 1cb9cbb7..70a3ff2c 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsArrayTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsArrayTest.java @@ -20,32 +20,32 @@ public void testMatchesAnArrayThatMatchesAllTheElementMatchers() { assertMatches("should match array with matching elements", array(equalTo("a"), equalTo("b"), equalTo("c")), new String[]{"a", "b", "c"}); } - + public void testDoesNotMatchAnArrayWhenElementsDoNotMatch() { assertDoesNotMatch("should not match array with different elements", array(equalTo("a"), equalTo("b")), new String[]{"b", "c"}); } - + public void testDoesNotMatchAnArrayOfDifferentSize() { assertDoesNotMatch("should not match larger array", array(equalTo("a"), equalTo("b")), new String[]{"a", "b", "c"}); assertDoesNotMatch("should not match smaller array", array(equalTo("a"), equalTo("b")), new String[]{"a"}); } - + public void testDoesNotMatchNull() { assertDoesNotMatch("should not match null", array(equalTo("a")), null); } - + public void testHasAReadableDescription() { assertDescription("[\"a\", \"b\"]", array(equalTo("a"), equalTo("b"))); } - + public void testHasAReadableMismatchDescriptionUsing() { assertMismatchDescription("element <0> was \"c\"", array(equalTo("a"), equalTo("b")), new String[]{"c", "b"}); } - + public void testHasAReadableMismatchDescriptionUsingCustomMatchers() { final BaseMatcher m = new BaseMatcher() { @Override public boolean matches(Object item) { return false; } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java index f19f2140..99bce034 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java @@ -68,7 +68,7 @@ public void testProvidesConvenientShortcutForHasSizeEqualTo() { public void testHasAReadableDescription() { assertDescription("a collection with size <3>", hasSize(equalTo(3))); } - + public void testCompilesWithATypedCollection() { // To prove Issue 43 ArrayList arrayList = new ArrayList(); diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyCollectionTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyCollectionTest.java index 513e2eba..f2d309dc 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyCollectionTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyCollectionTest.java @@ -34,7 +34,7 @@ public void testCompiles() { } private void needs(@SuppressWarnings("unused") Matcher> bar) { } - + private static Collection collectionOfValues() { return new ArrayList(asList("one", "three")); } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java index 65331926..145db2b3 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java @@ -18,27 +18,27 @@ protected Matcher createMatcher() { public void testReturnsTrueIfArgumentIsInCollection() { Collection collection = Arrays.asList(elements); Matcher isIn = new IsIn(collection); - + assertMatches("a", isIn, "a"); assertMatches("b", isIn, "b"); assertMatches("c", isIn, "c"); assertDoesNotMatch("d", isIn, "d"); } - + public void testReturnsTrueIfArgumentIsInArray() { Matcher isIn = new IsIn(elements); - + assertMatches("a", isIn, "a"); assertMatches("b", isIn, "b"); assertMatches("c", isIn, "c"); assertDoesNotMatch("d", isIn, "d"); } - + public void testHasReadableDescription() { Matcher isIn = new IsIn(elements); - - assertEquals("description", - "one of {\"a\", \"b\", \"c\"}", + + assertEquals("description", + "one of {\"a\", \"b\", \"c\"}", StringDescription.toString(isIn)); } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java index 63c3b1f5..d27ff3ff 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInAnyOrderTest.java @@ -16,7 +16,7 @@ public class IsIterableContainingInAnyOrderTest extends AbstractMatcherTest { @Override protected Matcher createMatcher() { return containsInAnyOrder(1, 2); - } + } public void testMatchesSingleItemIterable() { assertMatches("single item", containsInAnyOrder(1), asList(1)); @@ -25,15 +25,15 @@ public void testMatchesSingleItemIterable() { public void testDoesNotMatchEmpty() { assertMismatchDescription("no item matches: <1>, <2> in []", containsInAnyOrder(1, 2), Collections.emptyList()); } - + public void testMatchesIterableOutOfOrder() { assertMatches("Out of order", containsInAnyOrder(1, 2), asList(2, 1)); } - + public void testMatchesIterableInOrder() { assertMatches("In order", containsInAnyOrder(1, 2), asList(1, 2)); } - + public void testDoesNotMatchIfOneOfMultipleElementsMismatches() { assertMismatchDescription("not matched: <4>", containsInAnyOrder(1, 2, 3), asList(1, 2, 4)); } @@ -43,7 +43,7 @@ public void testDoesNotMatchIfThereAreMoreElementsThanMatchers() { final Matcher> helpTheCompilerOut = containsInAnyOrder(value(1), value(3)); assertMismatchDescription("not matched: ", helpTheCompilerOut, asList(make(1), make(2), make(3))); } - + public void testDoesNotMatchIfThereAreMoreMatchersThanElements() { assertMismatchDescription("no item matches: <4> in [<1>, <2>, <3>]", containsInAnyOrder(1, 2, 3, 4), asList(1, 2, 3)); } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java index 410baaf4..ad5c17fe 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java @@ -52,7 +52,7 @@ public void testDoesNotMatchEmptyIterable() throws Exception { public void testHasAReadableDescription() { assertDescription("iterable containing [<1>, <2>]", contains(1, 2)); } - + public void testCanHandleNullMatchers() { assertMatches(contains(null, null), asList(null, null)); } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java index 1e89c2d9..1c4150fc 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java @@ -20,20 +20,20 @@ protected Matcher createMatcher() { public void testMatchesSingletonMapContainingKey() { Map map = new HashMap(); map.put("a", 1); - + assertMatches("Matches single key", hasKey("a"), map); } - + public void testMatchesMapContainingKey() { Map map = new HashMap(); map.put("a", 1); map.put("b", 2); map.put("c", 3); - + assertMatches("Matches a", hasKey("a"), map); assertMatches("Matches c", hasKey("c"), map); } - + // No longer compiles // public void testMatchesMapContainingKeyWithNoGenerics() { @@ -68,17 +68,17 @@ public void testMatchesMapContainingKeyWithNumberKeys() throws Exception { public void testHasReadableDescription() { assertDescription("map containing [\"a\"->ANYTHING]", hasKey("a")); } - + public void testDoesNotMatchEmptyMap() { assertMismatchDescription("map was []", hasKey("Foo"), new HashMap()); } - + public void testDoesNotMatchMapMissingKey() { Map map = new TreeMap(); map.put("a", 1); map.put("b", 2); map.put("c", 3); - + assertMismatchDescription("map was [, , ]", hasKey("d"), map); } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java index 96383add..798eb90a 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java @@ -20,16 +20,16 @@ protected Matcher createMatcher() { public void testHasReadableDescription() { assertDescription("map containing [ANYTHING->\"a\"]", hasValue("a")); } - + public void testDoesNotMatchEmptyMap() { Map map = new HashMap(); assertMismatchDescription("map was []", hasValue(1), map); } - + public void testMatchesSingletonMapContainingValue() { Map map = new HashMap(); map.put("a", 1); - + assertMatches("Singleton map", hasValue(1), map); } @@ -38,10 +38,10 @@ public void testMatchesMapContainingValue() { map.put("a", 1); map.put("b", 2); map.put("c", 3); - - assertMatches("hasValue 1", hasValue(1), map); - assertMatches("hasValue 3", hasValue(3), map); - assertMismatchDescription("map was [, , ]", hasValue(4), map); + + assertMatches("hasValue 1", hasValue(1), map); + assertMatches("hasValue 3", hasValue(3), map); + assertMismatchDescription("map was [, , ]", hasValue(4), map); } } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java index e9966513..8739be58 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java @@ -66,12 +66,12 @@ public void testProvidesConvenientShortcutForHasSizeEqualTo() { public void testHasAReadableDescription() { assertDescription("a map with size <3>", aMapWithSize(equalTo(3))); } - + public void testCompilesWithATypedMap() { Map arrayList = new HashMap(); MatcherAssert.assertThat(arrayList, aMapWithSize(0)); } - + private static Map mapWithKeys(K... keys) { final Map result = new HashMap(); for (K key : keys) { From a665d5e23bdb1cd2c19387be11bfa00ee23515da Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:56:52 +0000 Subject: [PATCH 29/54] Java Code Style trailing whitespace org.hamcrest --- .../java/org/hamcrest/BaseDescription.java | 20 +++---- .../main/java/org/hamcrest/CoreMatchers.java | 24 ++++----- .../main/java/org/hamcrest/Description.java | 2 +- .../java/org/hamcrest/FeatureMatcher.java | 10 ++-- .../src/main/java/org/hamcrest/Matcher.java | 6 +-- .../main/java/org/hamcrest/MatcherAssert.java | 6 +-- .../src/main/java/org/hamcrest/Matchers.java | 54 +++++++++---------- .../java/org/hamcrest/SelfDescribing.java | 2 +- .../java/org/hamcrest/StringDescription.java | 4 +- .../hamcrest/TypeSafeDiagnosingMatcher.java | 16 +++--- .../java/org/hamcrest/TypeSafeMatcher.java | 22 ++++---- .../org/hamcrest/AbstractMatcherTest.java | 4 +- .../org/hamcrest/BaseDescriptionTest.java | 20 +++---- .../hamcrest/CustomTypeSafeMatcherTest.java | 2 +- .../java/org/hamcrest/FeatureMatcherTest.java | 4 +- 15 files changed, 98 insertions(+), 98 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/BaseDescription.java b/hamcrest/src/main/java/org/hamcrest/BaseDescription.java index 5f692b8a..fb06f5b6 100644 --- a/hamcrest/src/main/java/org/hamcrest/BaseDescription.java +++ b/hamcrest/src/main/java/org/hamcrest/BaseDescription.java @@ -18,13 +18,13 @@ public Description appendText(String text) { append(text); return this; } - + @Override public Description appendDescriptionOf(SelfDescribing value) { value.describeTo(this); return this; } - + @Override public Description appendValue(Object value) { if (value == null) { @@ -75,16 +75,16 @@ private String descriptionOf(Object value) { public final Description appendValueList(String start, String separator, String end, T... values) { return appendValueList(start, separator, end, Arrays.asList(values)); } - + @Override public Description appendValueList(String start, String separator, String end, Iterable values) { return appendValueList(start, separator, end, values.iterator()); } - + private Description appendValueList(String start, String separator, String end, Iterator values) { return appendList(start, separator, end, new SelfDescribingValueIterator<>(values)); } - + @Override public Description appendList(String start, String separator, String end, Iterable values) { return appendList(start, separator, end, values.iterator()); @@ -92,7 +92,7 @@ public Description appendList(String start, String separator, String end, Iterab private Description appendList(String start, String separator, String end, Iterator i) { boolean separate = false; - + append(start); while (i.hasNext()) { if (separate) append(separator); @@ -100,13 +100,13 @@ private Description appendList(String start, String separator, String end, Itera separate = true; } append(end); - + return this; } /** - * Append the String str to the description. - * The default implementation passes every character to {@link #append(char)}. + * Append the String str to the description. + * The default implementation passes every character to {@link #append(char)}. * Override in subclasses to provide an efficient implementation. * * @param str @@ -117,7 +117,7 @@ protected void append(String str) { append(str.charAt(i)); } } - + /** * Append the char c to the description. * diff --git a/hamcrest/src/main/java/org/hamcrest/CoreMatchers.java b/hamcrest/src/main/java/org/hamcrest/CoreMatchers.java index 0f6b9f06..d1f18024 100644 --- a/hamcrest/src/main/java/org/hamcrest/CoreMatchers.java +++ b/hamcrest/src/main/java/org/hamcrest/CoreMatchers.java @@ -199,7 +199,7 @@ public static org.hamcrest.Matcher anything() { /** * Creates a matcher that always matches, regardless of the examined object, but describes * itself with the specified {@link String}. - * + * * @param description * a meaningful {@link String} used when describing itself * @return The matcher. @@ -286,17 +286,17 @@ public static org.hamcrest.Matcher> hasItems(T... item * Creates a matcher that matches when the examined object is logically equal to the specified * operand, as determined by calling the {@link java.lang.Object#equals} method on * the examined object. - * + * *

If the specified operand is null then the created matcher will only match if * the examined object's equals method returns true when passed a * null (which would be a violation of the equals contract), unless the * examined object itself is null, in which case the matcher will return a positive * match.

- * + * *

The created matcher provides a special behaviour when examining Arrays, whereby * it will match if both the operand and the examined object are arrays of the same length and * contain items that are equal to each other (according to the above rules) in the same - * indexes.

+ * indexes.

* For example: *
    * assertThat("foo", equalTo("foo"));
@@ -329,7 +329,7 @@ public static org.hamcrest.Matcher equalToObject(java.lang.Obj
    * Creates a matcher that matches when the examined object is an instance of the specified type,
    * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the
    * the examined object.
-   * 
+   *
    * 

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

@@ -350,7 +350,7 @@ public static org.hamcrest.Matcher any(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 {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. - * + * *

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

* For example: *
assertThat(new Canoe(), instanceOf(Paddlable.class));
@@ -489,7 +489,7 @@ public static org.hamcrest.Matcher theInstance(T target) { * {@link String} anywhere. * For example: *
assertThat("myStringOfNote", containsString("ring"))
- * + * * @param substring * the substring that the returned matcher will expect to find within any examined string * @return The matcher. @@ -503,7 +503,7 @@ public static org.hamcrest.Matcher containsString(java.lang.St * {@link String} anywhere, ignoring case. * For example: *
assertThat("myStringOfNote", containsString("ring"))
- * + * * @param substring * the substring that the returned matcher will expect to find within any examined string * @return The matcher. @@ -519,7 +519,7 @@ public static org.hamcrest.Matcher containsStringIgnoringCase( *

* For example: *
assertThat("myStringOfNote", startsWith("my"))
- * + * * @param prefix * the substring that the returned matcher will expect at the start of any examined string * @return The matcher. @@ -535,7 +535,7 @@ public static org.hamcrest.Matcher startsWith(java.lang.String *

* For example: *
assertThat("myStringOfNote", startsWith("my"))
- * + * * @param prefix * the substring that the returned matcher will expect at the start of any examined string * @return The matcher. @@ -549,7 +549,7 @@ public static org.hamcrest.Matcher startsWithIgnoringCase(java * {@link String}. * For example: *
assertThat("myStringOfNote", endsWith("Note"))
- * + * * @param suffix * the substring that the returned matcher will expect at the end of any examined string * @return The matcher. @@ -563,7 +563,7 @@ public static org.hamcrest.Matcher endsWith(java.lang.String s * {@link String}, ignoring case. * For example: *
assertThat("myStringOfNote", endsWith("Note"))
- * + * * @param suffix * the substring that the returned matcher will expect at the end of any examined string * @return The matcher. diff --git a/hamcrest/src/main/java/org/hamcrest/Description.java b/hamcrest/src/main/java/org/hamcrest/Description.java index acaff588..24ed3d00 100644 --- a/hamcrest/src/main/java/org/hamcrest/Description.java +++ b/hamcrest/src/main/java/org/hamcrest/Description.java @@ -11,7 +11,7 @@ public interface Description { * A description that consumes input but does nothing. */ static final Description NONE = new NullDescription(); - + /** * Appends some plain text to the description. * diff --git a/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java b/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java index 71bcbed2..11f79606 100644 --- a/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java @@ -4,17 +4,17 @@ /** * Supporting class for matching a feature of an object. Implement featureValueOf() - * in a subclass to pull out the feature to be matched against. + * in a subclass to pull out the feature to be matched against. * * @param The type of the object to be matched * @param The type of the feature to be matched */ public abstract class FeatureMatcher extends TypeSafeDiagnosingMatcher { - private static final ReflectiveTypeFinder TYPE_FINDER = new ReflectiveTypeFinder("featureValueOf", 1, 0); + private static final ReflectiveTypeFinder TYPE_FINDER = new ReflectiveTypeFinder("featureValueOf", 1, 0); private final Matcher subMatcher; private final String featureDescription; private final String featureName; - + /** * Constructor * @param subMatcher The matcher to apply to the feature @@ -27,7 +27,7 @@ public FeatureMatcher(Matcher subMatcher, String featureDescription, this.featureDescription = featureDescription; this.featureName = featureName; } - + /** * Implement this to extract the interesting feature. * @param actual the target object @@ -45,7 +45,7 @@ protected boolean matchesSafely(T actual, Description mismatch) { } return true; } - + @Override public final void describeTo(Description description) { description.appendText(featureDescription).appendText(" ") diff --git a/hamcrest/src/main/java/org/hamcrest/Matcher.java b/hamcrest/src/main/java/org/hamcrest/Matcher.java index 79735c0d..dffc09ab 100644 --- a/hamcrest/src/main/java/org/hamcrest/Matcher.java +++ b/hamcrest/src/main/java/org/hamcrest/Matcher.java @@ -39,12 +39,12 @@ public interface Matcher extends SelfDescribing { * @see BaseMatcher */ boolean matches(Object actual); - + /** * Generate a description of why the matcher has not accepted the item. * The description will be part of a larger description of why a matching - * failed, so it should be concise. - * This method assumes that matches(item) is false, but + * failed, so it should be concise. + * This method assumes that matches(item) is false, but * will not check this. * * @param actual The item that the Matcher has rejected. diff --git a/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java b/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java index c6b1b92b..b15a7ecd 100644 --- a/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java +++ b/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java @@ -5,7 +5,7 @@ public class MatcherAssert { public static void assertThat(T actual, Matcher matcher) { assertThat("", actual, matcher); } - + public static void assertThat(String reason, T actual, Matcher matcher) { if (!matcher.matches(actual)) { Description description = new StringDescription(); @@ -16,11 +16,11 @@ public static void assertThat(String reason, T actual, Matcher ma .appendText(System.lineSeparator()) .appendText(" but: "); matcher.describeMismatch(actual, description); - + throw new AssertionError(description.toString()); } } - + public static void assertThat(String reason, boolean assertion) { if (!assertion) { throw new AssertionError(reason); diff --git a/hamcrest/src/main/java/org/hamcrest/Matchers.java b/hamcrest/src/main/java/org/hamcrest/Matchers.java index 6c1ba01b..38907b1b 100644 --- a/hamcrest/src/main/java/org/hamcrest/Matchers.java +++ b/hamcrest/src/main/java/org/hamcrest/Matchers.java @@ -412,7 +412,7 @@ public static org.hamcrest.Matcher anything() { /** * Creates a matcher that always matches, regardless of the examined object, but describes * itself with the specified {@link String}. - * + * * @param description * a meaningful {@link String} used when describing itself * @return The matcher. @@ -499,17 +499,17 @@ public static org.hamcrest.Matcher> hasItems(T... item * Creates a matcher that matches when the examined object is logically equal to the specified * operand, as determined by calling the {@link java.lang.Object#equals} method on * the examined object. - * + * *

If the specified operand is null then the created matcher will only match if * the examined object's equals method returns true when passed a * null (which would be a violation of the equals contract), unless the * examined object itself is null, in which case the matcher will return a positive * match.

- * + * *

The created matcher provides a special behaviour when examining Arrays, whereby * it will match if both the operand and the examined object are arrays of the same length and * contain items that are equal to each other (according to the above rules) in the same - * indexes.

+ * indexes.

* For example: *
    * assertThat("foo", equalTo("foo"));
@@ -542,7 +542,7 @@ public static org.hamcrest.Matcher equalToObject(java.lang.Obj
    * Creates a matcher that matches when the examined object is an instance of the specified type,
    * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the
    * the examined object.
-   * 
+   *
    * 

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

@@ -563,7 +563,7 @@ public static org.hamcrest.Matcher any(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 {@link java.lang.Class#isInstance(Object)} method on that type, passing the * the examined object. - * + * *

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

* For example: *
assertThat(new Canoe(), instanceOf(Paddlable.class));
@@ -696,13 +696,13 @@ public static org.hamcrest.Matcher sameInstance(T target) { public static org.hamcrest.Matcher theInstance(T target) { return org.hamcrest.core.IsSame.theInstance(target); } - + /** * Creates a matcher that matches if the examined {@link String} contains the specified * {@link String} anywhere. * For example: *
assertThat("myStringOfNote", containsString("ring"))
- * + * * @param substring * the substring that the returned matcher will expect to find within any examined string * @return The matcher. @@ -716,7 +716,7 @@ public static Matcher containsString(java.lang.String substrin * {@link String} anywhere, ignoring case. * For example: *
assertThat("myStringOfNote", containsStringIgnoringCase("Ring"))
- * + * * @param substring * the substring that the returned matcher will expect to find within any examined string * @return The matcher. @@ -732,7 +732,7 @@ public static Matcher containsStringIgnoringCase(java.lang.Str *

* For example: *
assertThat("myStringOfNote", startsWith("my"))
- * + * * @param prefix * the substring that the returned matcher will expect at the start of any examined string * @return The matcher. @@ -748,7 +748,7 @@ public static Matcher startsWith(java.lang.String prefix) { *

* For example: *
assertThat("myStringOfNote", startsWithIgnoringCase("My"))
- * + * * @param prefix * the substring that the returned matcher will expect at the start of any examined string * @return The matcher. @@ -762,7 +762,7 @@ public static Matcher startsWithIgnoringCase(java.lang.String * {@link String}. * For example: *
assertThat("myStringOfNote", endsWith("Note"))
- * + * * @param suffix * the substring that the returned matcher will expect at the end of any examined string * @return The matcher. @@ -776,7 +776,7 @@ public static Matcher endsWith(java.lang.String suffix) { * {@link String}, ignoring case. * For example: *
assertThat("myStringOfNote", endsWithIgnoringCase("note"))
- * + * * @param suffix * the substring that the returned matcher will expect at the end of any examined string * @return The matcher. @@ -1612,7 +1612,7 @@ public static org.hamcrest.Matcher isIn(T[] elements) { * specified elements. * For example: *
assertThat("foo", isOneOf("bar", "foo"))
- * + * * @deprecated use is(oneOf(...)) instead * @param * the matcher type. @@ -1648,7 +1648,7 @@ public static org.hamcrest.Matcher oneOf(T... elements) { * to the specified operand, within a range of +/- error. * For example: *
assertThat(1.03, is(closeTo(1.0, 0.03)))
- * + * * @param operand * the expected value of matching doubles * @param error @@ -1676,7 +1676,7 @@ public static org.hamcrest.Matcher notANumber() { * is done by BigDecimals {@link java.math.BigDecimal#compareTo(java.math.BigDecimal)} method. * For example: *
assertThat(new BigDecimal("1.03"), is(closeTo(new BigDecimal("1.0"), new BigDecimal("0.03"))))
- * + * * @param operand * the expected value of matching BigDecimals * @param error @@ -1776,7 +1776,7 @@ public static > org.hamcrest.Matcher lessTh * the specified expectedString, ignoring case. * For example: *
assertThat("Foo", equalToIgnoringCase("FOO"))
- * + * * @param expectedString * the expected value of matched strings * @return The matcher. @@ -1842,7 +1842,7 @@ public static Matcher emptyString() { * has zero length. * For example: *
assertThat(((String)null), isEmptyOrNullString())
- * + * * @deprecated use is(emptyOrNullString()) instead * @return The matcher. */ @@ -1855,7 +1855,7 @@ public static Matcher isEmptyOrNullString() { * Creates a matcher of {@link String} that matches when the examined string has zero length. * For example: *
assertThat("", isEmptyString())
- * + * * @deprecated use is(emptyString()) instead * @return The matcher. */ @@ -1918,7 +1918,7 @@ public static Matcher matchesPattern(java.lang.String regex) { * For example: *
assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))
* fails as "foo" occurs before "bar" in the string "myfoobarbaz" - * + * * @param substrings * the substrings that must be contained within matching strings * @return The matcher. @@ -1933,7 +1933,7 @@ public static Matcher stringContainsInOrder(java.lang.Iterable * For example: *
assertThat("myfoobarbaz", stringContainsInOrder("bar", "foo"))
* fails as "foo" occurs before "bar" in the string "myfoobarbaz" - * + * * @param substrings * the substrings that must be contained within matching strings * @return The matcher. @@ -2027,7 +2027,7 @@ public static org.hamcrest.Matcher> typeCompatibleWith(ja * derived from eventClass announced by source. * For example: *
assertThat(myEvent, is(eventFrom(PropertyChangeEvent.class, myBean)))
- * + * * @param eventClass * the class of the event to match on * @param source @@ -2043,7 +2043,7 @@ public static org.hamcrest.Matcher eventFrom(java.lang.Cl * announced by source. * For example: *
assertThat(myEvent, is(eventFrom(myBean)))
- * + * * @param source * the source of the event * @return The matcher. @@ -2113,7 +2113,7 @@ public static Matcher samePropertyValuesAs(B expectedBean, String... igno * specified xPath that satisfies the specified valueMatcher. * For example: *
assertThat(xml, hasXPath("/root/something[2]/cheese", equalTo("Cheddar")))
- * + * * @param xPath * the target xpath * @param valueMatcher @@ -2130,7 +2130,7 @@ public static org.hamcrest.Matcher hasXPath(java.lang.String x * the specified valueMatcher. * For example: *
assertThat(xml, hasXPath("/root/something[2]/cheese", myNs, equalTo("Cheddar")))
- * + * * @param xPath * the target xpath * @param namespaceContext @@ -2148,7 +2148,7 @@ public static org.hamcrest.Matcher hasXPath(java.lang.String x * at the specified xPath, with any content. * For example: *
assertThat(xml, hasXPath("/root/something[2]/cheese"))
- * + * * @param xPath * the target xpath * @return The matcher. @@ -2162,7 +2162,7 @@ public static org.hamcrest.Matcher hasXPath(java.lang.String x * at the specified xPath within the specified namespace context, with any content. * For example: *
assertThat(xml, hasXPath("/root/something[2]/cheese", myNs))
- * + * * @param xPath * the target xpath * @param namespaceContext diff --git a/hamcrest/src/main/java/org/hamcrest/SelfDescribing.java b/hamcrest/src/main/java/org/hamcrest/SelfDescribing.java index 85daba4d..86fb099a 100644 --- a/hamcrest/src/main/java/org/hamcrest/SelfDescribing.java +++ b/hamcrest/src/main/java/org/hamcrest/SelfDescribing.java @@ -6,7 +6,7 @@ public interface SelfDescribing { /** * Generates a description of the object. The description may be part of a - * a description of a larger object of which this is just a component, so it + * a description of a larger object of which this is just a component, so it * should be worded appropriately. * * @param description diff --git a/hamcrest/src/main/java/org/hamcrest/StringDescription.java b/hamcrest/src/main/java/org/hamcrest/StringDescription.java index 8431c45f..0e3cf45d 100644 --- a/hamcrest/src/main/java/org/hamcrest/StringDescription.java +++ b/hamcrest/src/main/java/org/hamcrest/StringDescription.java @@ -15,7 +15,7 @@ public StringDescription() { public StringDescription(Appendable out) { this.out = out; } - + /** * Return the description of a {@link SelfDescribing} object as a String. * @@ -57,7 +57,7 @@ protected void append(char c) { throw new RuntimeException("Could not write description", e); } } - + /** * Returns the description as a string. */ diff --git a/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java b/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java index 31497f01..af1e2288 100644 --- a/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java @@ -6,8 +6,8 @@ /** * 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()
. + * This implements the null check, checks the type and then casts. + * To use, implement
matchesSafely()
. * * @param * the matcher type. @@ -16,7 +16,7 @@ * @author Steve Freeman */ public abstract class TypeSafeDiagnosingMatcher extends BaseMatcher { - private static final ReflectiveTypeFinder TYPE_FINDER = new ReflectiveTypeFinder("matchesSafely", 2, 0); + private static final ReflectiveTypeFinder TYPE_FINDER = new ReflectiveTypeFinder("matchesSafely", 2, 0); private final Class expectedType; /** @@ -32,8 +32,8 @@ public abstract class TypeSafeDiagnosingMatcher extends BaseMatcher { protected abstract boolean matchesSafely(T item, Description mismatchDescription); /** - * Use this constructor if the subclass that implements matchesSafely - * is not the class that binds <T> to a type. + * Use this constructor if the subclass that implements matchesSafely + * is not the class that binds <T> to a type. * * @param expectedType The expectedType of the actual value. */ @@ -42,20 +42,20 @@ protected TypeSafeDiagnosingMatcher(Class expectedType) { } /** - * Use this constructor if the subclass that implements matchesSafely + * Use this constructor if the subclass that implements matchesSafely * is not the class that binds <T> to a type. * * @param typeFinder A type finder to extract the type */ protected TypeSafeDiagnosingMatcher(ReflectiveTypeFinder typeFinder) { - this.expectedType = typeFinder.findExpectedType(getClass()); + this.expectedType = typeFinder.findExpectedType(getClass()); } /** * The default constructor for simple sub types */ protected TypeSafeDiagnosingMatcher() { - this(TYPE_FINDER); + this(TYPE_FINDER); } @Override diff --git a/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java b/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java index 2ea81a9f..e8a028d2 100644 --- a/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java @@ -14,7 +14,7 @@ */ public abstract class TypeSafeMatcher extends BaseMatcher { private static final ReflectiveTypeFinder TYPE_FINDER = new ReflectiveTypeFinder("matchesSafely", 1, 0); - + final private Class expectedType; /** @@ -23,26 +23,26 @@ public abstract class TypeSafeMatcher extends BaseMatcher { protected TypeSafeMatcher() { this(TYPE_FINDER); } - + /** - * Use this constructor if the subclass that implements matchesSafely - * is not the class that binds <T> to a type. + * Use this constructor if the subclass that implements matchesSafely + * is not the class that binds <T> to a type. * @param expectedType The expectedType of the actual value. */ protected TypeSafeMatcher(Class expectedType) { this.expectedType = expectedType; } - + /** - * Use this constructor if the subclass that implements matchesSafely + * Use this constructor if the subclass that implements matchesSafely * is not the class that binds <T> to a type. * * @param typeFinder A type finder to extract the type */ protected TypeSafeMatcher(ReflectiveTypeFinder typeFinder) { - this.expectedType = typeFinder.findExpectedType(getClass()); + this.expectedType = typeFinder.findExpectedType(getClass()); } - + /** * Subclasses should implement this. The item will already have been checked for * the specific type and will never be null. @@ -52,7 +52,7 @@ protected TypeSafeMatcher(ReflectiveTypeFinder typeFinder) { * @return boolean true/false depending if item matches matcher. */ protected abstract boolean matchesSafely(T item); - + /** * Subclasses should override this. The item will already have been checked for * the specific type and will never be null. @@ -65,7 +65,7 @@ protected TypeSafeMatcher(ReflectiveTypeFinder typeFinder) { protected void describeMismatchSafely(T item, Description mismatchDescription) { super.describeMismatch(item, mismatchDescription); } - + /** * Methods made final to prevent accidental override. * If you need to override this, there's no point on extending TypeSafeMatcher. @@ -81,7 +81,7 @@ public final boolean matches(Object item) { && expectedType.isInstance(item) && matchesSafely((T) item); } - + @SuppressWarnings("unchecked") @Override final public void describeMismatch(Object item, Description description) { diff --git a/hamcrest/src/test/java/org/hamcrest/AbstractMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/AbstractMatcherTest.java index f11dec3b..e22e23e0 100644 --- a/hamcrest/src/test/java/org/hamcrest/AbstractMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/AbstractMatcherTest.java @@ -9,7 +9,7 @@ public abstract class AbstractMatcherTest extends TestCase { * Create an instance of the Matcher so some generic safety-net tests can be run on it. */ protected abstract Matcher createMatcher(); - + public static void assertMatches(Matcher matcher, T arg) { assertMatches("Expected match, but mismatched", matcher, arg); } @@ -38,7 +38,7 @@ public static void assertMismatchDescription(String expected, Matcher matcher) { try { matcher.matches(null); diff --git a/hamcrest/src/test/java/org/hamcrest/BaseDescriptionTest.java b/hamcrest/src/test/java/org/hamcrest/BaseDescriptionTest.java index 6a6e13ee..8dc77d4f 100644 --- a/hamcrest/src/test/java/org/hamcrest/BaseDescriptionTest.java +++ b/hamcrest/src/test/java/org/hamcrest/BaseDescriptionTest.java @@ -14,19 +14,19 @@ public final class BaseDescriptionTest { } }; - @Test public void + @Test public void describesAppendedNullValue() { baseDescription.appendValue(null); assertEquals("null", result.toString()); } - @Test public void + @Test public void quotesAppendedStringValue() { baseDescription.appendValue("foo"); assertEquals("\"foo\"", result.toString()); } - @Test public void + @Test public void quotesAppendedCharacterValue() { baseDescription.appendValue('f'); assertEquals("\"f\"", result.toString()); @@ -74,39 +74,39 @@ public final class BaseDescriptionTest { assertEquals("<2s>", result.toString()); } - @Test public void + @Test public void bracketsAppendedLongValue() { baseDescription.appendValue(Long.valueOf("2")); assertEquals("<2L>", result.toString()); } - @Test public void + @Test public void bracketsAppendedFloatValue() { baseDescription.appendValue(Float.valueOf("1.2")); assertEquals("<1.2F>", result.toString()); } - @Test public void + @Test public void describesAppendedArrayValue() { baseDescription.appendValue(new String[] {"2", "3"}); assertEquals("[\"2\", \"3\"]", result.toString()); } - @Test public void + @Test public void bracketsAppendedObjectValue() { final Object value = new Object(); baseDescription.appendValue(value); assertEquals("<" + value.toString() + ">", result.toString()); } - - @Test public void + + @Test public void safelyDescribesAppendedValueOfObjectWhoseToStringThrowsAnException() { final Object value = new Object() { @Override public String toString() { throw new UnsupportedOperationException(); } }; - + final String expected = value.getClass().getName() + "@" + Integer.toHexString(value.hashCode()); baseDescription.appendValue(value); assertEquals("<" + expected + ">", result.toString()); diff --git a/hamcrest/src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java index e6c4e4c6..a4e2f060 100644 --- a/hamcrest/src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java @@ -33,7 +33,7 @@ public void describeMismatchSafely(String item, Description mismatchDescription) isNullSafe() { assertNullSafe(customMatcher); } - + @Test public void copesWithUnknownTypes() { assertUnknownTypeSafe(customMatcher); diff --git a/hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java index 8d864eb8..b277c290 100644 --- a/hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java @@ -28,7 +28,7 @@ public final class FeatureMatcherTest { @Test public void doesNotThrowClassCastException() { resultMatcher.matches(new ShouldNotMatch()); - StringDescription mismatchDescription = new StringDescription(); + StringDescription mismatchDescription = new StringDescription(); resultMatcher.describeMismatch(new ShouldNotMatch(), mismatchDescription); assertEquals("was ShouldNotMatch ", mismatchDescription.toString()); } @@ -54,7 +54,7 @@ public String getResult() { public static class ShouldNotMatch { @Override public String toString() { return "ShouldNotMatch"; } - } + } private static FeatureMatcher resultMatcher() { return new FeatureMatcher(new Match("bar"), "Thingy with result", "result") { From 02c1d7b7b25f9717b029334b3e2e50ad5f581826 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:57:13 +0000 Subject: [PATCH 30/54] Java Code Style trailing whitespace org.hamcrest.beans --- .../hamcrest/beans/HasPropertyWithValue.java | 6 +++--- .../org/hamcrest/beans/HasPropertyTest.java | 2 +- .../beans/HasPropertyWithValueTest.java | 12 ++++++------ .../beans/SamePropertyValuesAsTest.java | 18 +++++++++--------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java b/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java index e4aca0dd..a70e3096 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java @@ -37,7 +37,7 @@ * 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: @@ -45,14 +45,14 @@ * 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 diff --git a/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyTest.java b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyTest.java index 449a1f90..5a7ed7b9 100644 --- a/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyTest.java +++ b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyTest.java @@ -20,7 +20,7 @@ public final class HasPropertyTest { @Test public void copesWithNullsAndUnknownTypes() { Matcher matcher = hasProperty("irrelevant"); - + assertNullSafe(matcher); assertUnknownTypeSafe(matcher); } diff --git a/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java index 069d8567..61b1649b 100644 --- a/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java +++ b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java @@ -48,18 +48,18 @@ public void testMatchesBeanWithoutInfoWithMatchedNamedBooleanProperty() { public void testMatchesBeanWithInfoWithMatchedNamedProperty() { assertMatches("with bean info", hasProperty("property", equalTo("with info")), beanWithInfo); - assertMismatchDescription("property 'property' was \"with info\"", + assertMismatchDescription("property 'property' was \"with info\"", hasProperty("property", equalTo("without info")), beanWithInfo); } public void testDoesNotMatchBeanWithoutInfoOrMatchedNamedProperty() { - assertMismatchDescription("No property \"nonExistentProperty\"", + assertMismatchDescription("No property \"nonExistentProperty\"", hasProperty("nonExistentProperty", anything()), shouldNotMatch); } public void testDoesNotMatchWriteOnlyProperty() { assertMismatchDescription("property \"writeOnlyProperty\" is not readable", - hasProperty("writeOnlyProperty", anything()), shouldNotMatch); + hasProperty("writeOnlyProperty", anything()), shouldNotMatch); } public void testMatchesPath() { @@ -78,7 +78,7 @@ public void testDescribeTo() { public void testMatchesPropertyAndValue() { assertMatches("property with value", hasProperty("property", anything()), beanWithInfo); } - + public void testDoesNotWriteMismatchIfPropertyMatches() { Description description = new StringDescription(); hasProperty( "property", anything()).describeMismatch(beanWithInfo, description); @@ -161,8 +161,8 @@ public static class BeanWithInfoBeanInfo extends SimpleBeanInfo { @Override public PropertyDescriptor[] getPropertyDescriptors() { try { - return new PropertyDescriptor[] { - new PropertyDescriptor("property", BeanWithInfo.class, "property", null) + return new PropertyDescriptor[] { + new PropertyDescriptor("property", BeanWithInfo.class, "property", null) }; } catch (IntrospectionException e) { throw new AssertionError("Introspection exception", e); diff --git a/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java b/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java index 844bb911..d448212a 100644 --- a/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java +++ b/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java @@ -10,8 +10,8 @@ public class SamePropertyValuesAsTest extends AbstractMatcherTest { private static final Value aValue = new Value("expected"); private static final ExampleBean expectedBean = new ExampleBean("same", 1, aValue); private static final ExampleBean actualBean = new ExampleBean("same", 1, aValue); - - + + @Override protected Matcher createMatcher() { return samePropertyValuesAs(expectedBean); @@ -20,9 +20,9 @@ protected Matcher createMatcher() { public void test_reports_match_when_all_properties_match() { assertMatches("matched properties", samePropertyValuesAs(expectedBean), actualBean); } - + public void test_reports_mismatch_when_actual_type_is_not_assignable_to_expected_type() { - assertMismatchDescription("is incompatible type: ExampleBean", + assertMismatchDescription("is incompatible type: ExampleBean", samePropertyValuesAs((Object)aValue), actualBean); } @@ -36,7 +36,7 @@ public void test_reports_mismatch_on_first_property_difference() { } public void test_matches_beans_with_inheritance_but_no_extra_properties() { - assertMatches("sub type with same properties", + assertMatches("sub type with same properties", samePropertyValuesAs(expectedBean), new SubBeanWithNoExtraProperties("same", 1, aValue)); } @@ -89,7 +89,7 @@ public String toString() { return "Value " + value; } } - + @SuppressWarnings("unused") public static class ExampleBean { private String stringProperty; @@ -101,7 +101,7 @@ public ExampleBean(String stringProperty, int intProperty, Value valueProperty) this.intProperty = intProperty; this.valueProperty = valueProperty; } - + public String getStringProperty() { return stringProperty; } @@ -114,13 +114,13 @@ public Value getValueProperty() { @Override public String toString() { return "an ExampleBean"; } } - + public static class SubBeanWithNoExtraProperties extends ExampleBean { public SubBeanWithNoExtraProperties(String stringProperty, int intProperty, Value valueProperty) { super(stringProperty, intProperty, valueProperty); } } - + public static class SubBeanWithExtraProperty extends ExampleBean { public SubBeanWithExtraProperty(String stringProperty, int intProperty, Value valueProperty) { super(stringProperty, intProperty, valueProperty); From 19a077926ffd63aef9bc6c60b0bd3570f88d99d3 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:57:24 +0000 Subject: [PATCH 31/54] Java Code Style trailing whitespace org.hamcrest.core --- .../main/java/org/hamcrest/core/AnyOf.java | 2 +- .../org/hamcrest/core/CombinableMatcher.java | 4 ++-- .../java/org/hamcrest/core/DescribedAs.java | 14 +++++------ .../hamcrest/core/IsCollectionContaining.java | 4 ++-- .../main/java/org/hamcrest/core/IsEqual.java | 6 ++--- .../java/org/hamcrest/core/IsInstanceOf.java | 22 ++++++++--------- .../hamcrest/core/IsIterableContaining.java | 10 ++++---- .../main/java/org/hamcrest/core/IsNot.java | 2 +- .../main/java/org/hamcrest/core/IsSame.java | 6 ++--- .../hamcrest/core/ShortcutCombination.java | 8 +++---- .../org/hamcrest/core/SubstringMatcher.java | 2 +- .../java/org/hamcrest/core/AllOfTest.java | 14 +++++------ .../java/org/hamcrest/core/AnyOfTest.java | 8 +++---- .../org/hamcrest/core/CombinableTest.java | 4 ++-- .../core/IsCollectionContainingTest.java | 24 +++++++++---------- .../java/org/hamcrest/core/IsEqualTest.java | 2 +- .../core/IsIterableContainingTest.java | 22 ++++++++--------- .../java/org/hamcrest/core/IsNullTest.java | 6 ++--- .../java/org/hamcrest/core/IsSameTest.java | 2 +- .../test/java/org/hamcrest/core/IsTest.java | 4 ++-- .../org/hamcrest/core/SampleSubClass.java | 2 +- 21 files changed, 84 insertions(+), 84 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java b/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java index 20db6679..bcc1bb4f 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java +++ b/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java @@ -44,7 +44,7 @@ public void describeTo(Description description) { public static AnyOf anyOf(Iterable> matchers) { return new AnyOf<>(matchers); } - + /** * Creates a matcher that matches if the examined object matches ANY of the specified matchers. * For example: diff --git a/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java b/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java index b748793b..1d7db2fb 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java @@ -61,7 +61,7 @@ private ArrayList> templatedListWith(Matcher other public static CombinableBothMatcher both(Matcher matcher) { return new CombinableBothMatcher<>(matcher); } - + public static final class CombinableBothMatcher { private final Matcher first; public CombinableBothMatcher(Matcher matcher) { @@ -86,7 +86,7 @@ public CombinableMatcher and(Matcher other) { public static CombinableEitherMatcher either(Matcher matcher) { return new CombinableEitherMatcher<>(matcher); } - + public static final class CombinableEitherMatcher { private final Matcher first; public CombinableEitherMatcher(Matcher matcher) { diff --git a/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java b/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java index 2471775f..18fa97b8 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java +++ b/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java @@ -15,15 +15,15 @@ public class DescribedAs extends BaseMatcher { private final String descriptionTemplate; private final Matcher matcher; private final Object[] values; - - private final static Pattern ARG_PATTERN = Pattern.compile("%([0-9]+)"); - + + private final static Pattern ARG_PATTERN = Pattern.compile("%([0-9]+)"); + public DescribedAs(String descriptionTemplate, Matcher matcher, Object[] values) { this.descriptionTemplate = descriptionTemplate; this.matcher = matcher; this.values = values.clone(); } - + @Override public boolean matches(Object o) { return matcher.matches(o); @@ -32,19 +32,19 @@ public boolean matches(Object o) { @Override public void describeTo(Description description) { java.util.regex.Matcher arg = ARG_PATTERN.matcher(descriptionTemplate); - + int textStart = 0; while (arg.find()) { description.appendText(descriptionTemplate.substring(textStart, arg.start())); description.appendValue(values[parseInt(arg.group(1))]); textStart = arg.end(); } - + if (textStart < descriptionTemplate.length()) { description.appendText(descriptionTemplate.substring(textStart)); } } - + @Override public void describeMismatch(Object item, Description description) { matcher.describeMismatch(item, description); diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java b/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java index 348ae054..76b82166 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java @@ -25,7 +25,7 @@ public void describeTo(Description description) { delegate.describeTo(description); } - + /** * Creates a matcher for {@link Iterable}s that only matches when a single pass over the * examined {@link Iterable} yields at least one item that is matched by the specified @@ -85,7 +85,7 @@ public static Matcher> hasItem(T item) { public static Matcher> hasItems(Matcher... itemMatchers) { return IsIterableContaining.hasItems(itemMatchers); } - + /** * Creates a matcher for {@link Iterable}s that matches when consecutive passes over the * examined {@link Iterable} yield at least one item that is equal to the corresponding diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java b/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java index 7a2a1bf5..6b43e37d 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java @@ -32,11 +32,11 @@ private static boolean areEqual(Object actual, Object expected) { if (actual == null) { return expected == null; } - + if (expected != null && isArray(actual)) { return isArray(expected) && areArraysEqual(actual, expected); } - + return actual.equals(expected); } @@ -75,7 +75,7 @@ private static boolean isArray(Object o) { *

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.

+ * indexes.

* For example: *
      * assertThat("foo", equalTo("foo"));
diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java b/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java
index c0d366e6..a285e915 100644
--- a/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java
+++ b/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java
@@ -25,14 +25,14 @@ public IsInstanceOf(Class expectedClass) {
     }
 
     private static Class matchableClass(Class expectedClass) {
-      if (boolean.class.equals(expectedClass)) return Boolean.class; 
-      if (byte.class.equals(expectedClass)) return Byte.class; 
-      if (char.class.equals(expectedClass)) return Character.class; 
-      if (double.class.equals(expectedClass)) return Double.class; 
-      if (float.class.equals(expectedClass)) return Float.class; 
-      if (int.class.equals(expectedClass)) return Integer.class; 
-      if (long.class.equals(expectedClass)) return Long.class; 
-      if (short.class.equals(expectedClass)) return Short.class; 
+      if (boolean.class.equals(expectedClass)) return Boolean.class;
+      if (byte.class.equals(expectedClass)) return Byte.class;
+      if (char.class.equals(expectedClass)) return Character.class;
+      if (double.class.equals(expectedClass)) return Double.class;
+      if (float.class.equals(expectedClass)) return Float.class;
+      if (int.class.equals(expectedClass)) return Integer.class;
+      if (long.class.equals(expectedClass)) return Long.class;
+      if (short.class.equals(expectedClass)) return Short.class;
       return expectedClass;
     }
 
@@ -42,12 +42,12 @@ protected boolean matches(Object item, Description mismatch) {
         mismatch.appendText("null");
         return false;
       }
-      
+
       if (!matchableClass.isInstance(item)) {
         mismatch.appendValue(item).appendText(" is a " + item.getClass().getName());
         return false;
       }
-      
+
       return true;
     }
 
@@ -75,7 +75,7 @@ public void describeTo(Description description) {
     public static  Matcher instanceOf(Class type) {
         return (Matcher) new IsInstanceOf(type);
     }
-    
+
     /**
      * Creates a matcher that matches when the examined object is an instance of the specified type,
      * as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the
diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java b/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java
index 13104fea..19a3b2cb 100644
--- a/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java
+++ b/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java
@@ -54,7 +54,7 @@ public void describeTo(Description description) {
             .appendDescriptionOf(elementMatcher);
     }
 
-    
+
     /**
      * Creates a matcher for {@link Iterable}s that only matches when a single pass over the
      * examined {@link Iterable} yields at least one item that is matched by the specified
@@ -109,15 +109,15 @@ public static  Matcher> hasItem(T item) {
     @SafeVarargs
     public static  Matcher> hasItems(Matcher... itemMatchers) {
         List>> all = new ArrayList<>(itemMatchers.length);
-        
+
         for (Matcher elementMatcher : itemMatchers) {
           // Doesn't forward to hasItem() method so compiler can sort out generics.
           all.add(new IsIterableContaining<>(elementMatcher));
         }
-        
+
         return allOf(all);
     }
-    
+
     /**
      * Creates a matcher for {@link Iterable}s that matches when consecutive passes over the
      * examined {@link Iterable} yield at least one item that is equal to the corresponding
@@ -138,7 +138,7 @@ public static  Matcher> hasItems(T... items) {
         for (T item : items) {
             all.add(hasItem(item));
         }
-        
+
         return allOf(all);
     }
 
diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsNot.java b/hamcrest/src/main/java/org/hamcrest/core/IsNot.java
index 2f4d88a2..5351c9db 100644
--- a/hamcrest/src/main/java/org/hamcrest/core/IsNot.java
+++ b/hamcrest/src/main/java/org/hamcrest/core/IsNot.java
@@ -27,7 +27,7 @@ public void describeTo(Description description) {
         description.appendText("not ").appendDescriptionOf(matcher);
     }
 
-    
+
     /**
      * Creates a matcher that wraps an existing matcher, but inverts the logic by which
      * it will match.
diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsSame.java b/hamcrest/src/main/java/org/hamcrest/core/IsSame.java
index 8f24de8d..6d58741a 100644
--- a/hamcrest/src/main/java/org/hamcrest/core/IsSame.java
+++ b/hamcrest/src/main/java/org/hamcrest/core/IsSame.java
@@ -10,7 +10,7 @@
  */
 public class IsSame extends BaseMatcher {
     private final T object;
-    
+
     public IsSame(T object) {
         this.object = object;
     }
@@ -26,7 +26,7 @@ public void describeTo(Description description) {
                 .appendValue(object)
                 .appendText(")");
     }
-    
+
     /**
      * Creates a matcher that matches only when the examined object is the same instance as
      * the specified target object.
@@ -40,7 +40,7 @@ public void describeTo(Description description) {
     public static  Matcher sameInstance(T target) {
         return new IsSame(target);
     }
-    
+
     /**
      * Creates a matcher that matches only when the examined object is the same instance as
      * the specified target object.
diff --git a/hamcrest/src/main/java/org/hamcrest/core/ShortcutCombination.java b/hamcrest/src/main/java/org/hamcrest/core/ShortcutCombination.java
index 7b4daf03..7cfd04a7 100644
--- a/hamcrest/src/main/java/org/hamcrest/core/ShortcutCombination.java
+++ b/hamcrest/src/main/java/org/hamcrest/core/ShortcutCombination.java
@@ -11,13 +11,13 @@ abstract class ShortcutCombination extends BaseMatcher {
     public ShortcutCombination(Iterable> matchers) {
         this.matchers = matchers;
     }
-    
+
     @Override
     public abstract boolean matches(Object o);
-    
+
     @Override
     public abstract void describeTo(Description description);
-    
+
     protected boolean matches(Object o, boolean shortcut) {
         for (Matcher matcher : matchers) {
             if (matcher.matches(o) == shortcut) {
@@ -26,7 +26,7 @@ protected boolean matches(Object o, boolean shortcut) {
         }
         return !shortcut;
     }
-    
+
     public void describeTo(Description description, String operator) {
         description.appendList("(", " " + operator + " ", ")", matchers);
     }
diff --git a/hamcrest/src/main/java/org/hamcrest/core/SubstringMatcher.java b/hamcrest/src/main/java/org/hamcrest/core/SubstringMatcher.java
index f2b7cff0..75625958 100644
--- a/hamcrest/src/main/java/org/hamcrest/core/SubstringMatcher.java
+++ b/hamcrest/src/main/java/org/hamcrest/core/SubstringMatcher.java
@@ -29,7 +29,7 @@ public boolean matchesSafely(String item) {
     public void describeMismatchSafely(String item, Description mismatchDescription) {
       mismatchDescription.appendText("was \"").appendText(item).appendText("\"");
     }
-    
+
     @Override
     public void describeTo(Description description) {
         description.appendText("a string ")
diff --git a/hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java b/hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java
index ddc1567a..fb531645 100644
--- a/hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java
+++ b/hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java
@@ -18,15 +18,15 @@ public final class AllOfTest {
     @Test public void
     copesWithNullsAndUnknownTypes() {
         Matcher matcher = allOf(equalTo("irrelevant"), startsWith("irr"));
-        
+
         assertNullSafe(matcher);
         assertUnknownTypeSafe(matcher);
     }
-    
+
     @Test public void
     evaluatesToTheTheLogicalConjunctionOfTwoOtherMatchers() {
         Matcher matcher = allOf(startsWith("goo"), endsWith("ood"));
-        
+
         assertMatches("didn't pass both sub-matchers", matcher, "good");
         assertDoesNotMatch("didn't fail first sub-matcher", matcher, "mood");
         assertDoesNotMatch("didn't fail second sub-matcher", matcher, "goon");
@@ -36,11 +36,11 @@ public final class AllOfTest {
     @Test public void
     evaluatesToTheTheLogicalConjunctionOfManyOtherMatchers() {
         Matcher matcher = allOf(startsWith("g"), startsWith("go"), endsWith("d"), startsWith("go"), startsWith("goo"));
-        
+
         assertMatches("didn't pass all sub-matchers", matcher, "good");
         assertDoesNotMatch("didn't fail middle sub-matcher", matcher, "goon");
     }
-    
+
     @Test public void
     supportsMixedTypes() {
         final Matcher matcher = allOf(
@@ -48,10 +48,10 @@ public final class AllOfTest {
                 is(notNullValue()),
                 equalTo(new SampleBaseClass("good")),
                 equalTo(new SampleSubClass("ugly")));
-        
+
         assertDoesNotMatch("didn't fail last sub-matcher", matcher, new SampleSubClass("good"));
     }
-    
+
     @Test public void
     hasAReadableDescription() {
         assertDescription("(\"good\" and \"bad\" and \"ugly\")",
diff --git a/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java b/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java
index 480cddcb..73c24ca1 100644
--- a/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java
+++ b/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java
@@ -15,7 +15,7 @@ public final class AnyOfTest {
     @Test public void
     copesWithNullsAndUnknownTypes() {
         Matcher matcher = anyOf(equalTo("irrelevant"), startsWith("irr"));
-        
+
         assertNullSafe(matcher);
         assertUnknownTypeSafe(matcher);
     }
@@ -23,7 +23,7 @@ public final class AnyOfTest {
     @Test public void
     evaluatesToTheTheLogicalDisjunctionOfTwoOtherMatchers() {
         Matcher matcher = anyOf(startsWith("goo"), endsWith("ood"));
-        
+
         assertMatches("didn't pass both sub-matchers", matcher, "good");
         assertMatches("didn't pass second sub-matcher", matcher, "mood");
         assertMatches("didn't pass first sub-matcher", matcher, "goon");
@@ -33,7 +33,7 @@ public final class AnyOfTest {
     @Test public void
     evaluatesToTheTheLogicalDisjunctionOfManyOtherMatchers() {
         Matcher matcher = anyOf(startsWith("g"), startsWith("go"), endsWith("d"), startsWith("go"), startsWith("goo"));
-        
+
         assertMatches("didn't pass middle sub-matcher", matcher, "vlad");
         assertDoesNotMatch("didn't fail all sub-matchers", matcher, "flan");
     }
@@ -45,7 +45,7 @@ public final class AnyOfTest {
                 equalTo(new SampleBaseClass("bad")),
                 equalTo(new SampleBaseClass("good")),
                 equalTo(new SampleSubClass("ugly")));
-        
+
         assertMatches("didn't pass middle sub-matcher", matcher, new SampleSubClass("good"));
     }
 
diff --git a/hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java b/hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java
index 86e8805c..655c5120 100644
--- a/hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java
+++ b/hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java
@@ -29,7 +29,7 @@ public final class CombinableTest {
     @Test public void
     acceptsAndRejectsThreeAnds() {
         CombinableMatcher tripleAnd = NOT_3_AND_NOT_4.and(equalTo(2));
-        
+
         assertMatches("tripleAnd didn't pass", tripleAnd, 2);
         assertDoesNotMatch("tripleAnd didn't fail", tripleAnd, 3);
     }
@@ -49,7 +49,7 @@ public final class CombinableTest {
     @Test public void
     acceptsAndRejectsThreeOrs() {
         final CombinableMatcher tripleOr = EITHER_3_OR_4.or(equalTo(11));
-        
+
         assertMatches("tripleOr didn't pass", tripleOr, 11);
         assertDoesNotMatch("tripleOr didn't fail", tripleOr, 9);
     }
diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java
index 5616ed8a..f2bd17e8 100644
--- a/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java
+++ b/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java
@@ -23,7 +23,7 @@ protected Matcher createMatcher() {
 
     public void testMatchesACollectionThatContainsAnElementMatchingTheGivenMatcher() {
         Matcher> itemMatcher = hasItem(equalTo("a"));
-        
+
         assertMatches("should match list that contains 'a'",
                 itemMatcher, asList("a", "b", "c"));
     }
@@ -31,8 +31,8 @@ public void testMatchesACollectionThatContainsAnElementMatchingTheGivenMatcher()
     public void testDoesNotMatchCollectionThatDoesntContainAnElementMatchingTheGivenMatcher() {
         final Matcher> matcher1 = hasItem(mismatchable("a"));
         assertMismatchDescription("mismatches were: [mismatched: b, mismatched: c]", matcher1, asList("b", "c"));
-        
-        
+
+
         final Matcher> matcher2 = hasItem(equalTo("a"));
         assertMismatchDescription("was empty", matcher2, new ArrayList());
     }
@@ -44,7 +44,7 @@ public void testDoesNotMatchNull() {
     public void testHasAReadableDescription() {
         assertDescription("a collection containing \"a\"", hasItem(equalTo("a")));
     }
-    
+
     public void testCanMatchItemWhenCollectionHoldsSuperclass() // Issue 24
     {
       final Set s = new HashSet();
@@ -59,36 +59,36 @@ public void testMatchesAllItemsInCollection() {
         assertMatches("should match list containing all items",
                 matcher1,
                 asList("a", "b", "c"));
-        
+
         final Matcher> matcher2 = hasItems("a", "b", "c");
         assertMatches("should match list containing all items (without matchers)",
                 matcher2,
                 asList("a", "b", "c"));
-        
+
         final Matcher> matcher3 = hasItems(equalTo("a"), equalTo("b"), equalTo("c"));
         assertMatches("should match list containing all items in any order",
                 matcher3,
                 asList("c", "b", "a"));
-        
+
         final Matcher> matcher4 = hasItems(equalTo("a"), equalTo("b"), equalTo("c"));
         assertMatches("should match list containing all items plus others",
                 matcher4,
                 asList("e", "c", "b", "a", "d"));
-        
+
         final Matcher> matcher5 = hasItems(equalTo("a"), equalTo("b"), equalTo("c"));
         assertDoesNotMatch("should not match list unless it contains all items",
                 matcher5,
                 asList("e", "c", "b", "d")); // 'a' missing
     }
-    
-    
+
+
     private static Matcher mismatchable(final String string) {
       return new TypeSafeDiagnosingMatcher() {
         @Override
         protected boolean matchesSafely(String item, Description mismatchDescription) {
-          if (string.equals(item)) 
+          if (string.equals(item))
             return true;
-          
+
           mismatchDescription.appendText("mismatched: " + item);
           return false;
         }
diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsEqualTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsEqualTest.java
index a0c692a6..218c86e3 100644
--- a/hamcrest/src/test/java/org/hamcrest/core/IsEqualTest.java
+++ b/hamcrest/src/test/java/org/hamcrest/core/IsEqualTest.java
@@ -33,7 +33,7 @@ public final class IsEqualTest {
     @Test public void
     canCompareNullValues() {
         final Matcher matcher = equalTo(null);
-        
+
         assertMatches(matcher, null);
         assertDoesNotMatch(matcher, 2);
         assertDoesNotMatch(matcher, "hi");
diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java
index c4baba9d..b20942be 100644
--- a/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java
+++ b/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java
@@ -16,11 +16,11 @@
 import static org.hamcrest.core.IsEqual.equalTo;
 
 public final class IsIterableContainingTest {
-    
+
     @Test public void
     copesWithNullsAndUnknownTypes() {
         Matcher matcher = hasItem(equalTo("irrelevant"));
-        
+
         assertNullSafe(matcher);
         assertUnknownTypeSafe(matcher);
     }
@@ -35,7 +35,7 @@ public final class IsIterableContainingTest {
     @Test public void
     doesNotMatchCollectionWithoutAnElementForGivenMatcher() {
         final Matcher> matcher = hasItem(mismatchable("a"));
-        
+
         assertMismatchDescription("mismatches were: [mismatched: b, mismatched: c]", matcher, asList("b", "c"));
         assertMismatchDescription("was empty", matcher, new ArrayList());
     }
@@ -49,7 +49,7 @@ public final class IsIterableContainingTest {
     hasAReadableDescription() {
         assertDescription("a collection containing mismatchable: a", hasItem(mismatchable("a")));
     }
-    
+
     @Test public void
     canMatchItemWhenCollectionHoldsSuperclass() { // Issue 24
         final Set s = new HashSet<>();
@@ -64,24 +64,24 @@ public final class IsIterableContainingTest {
     matchesMultipleItemsInCollection() {
         final Matcher> matcher1 = hasItems(equalTo("a"), equalTo("b"), equalTo("c"));
         assertMatches("list containing all items", matcher1, asList("a", "b", "c"));
-        
+
         final Matcher> matcher2 = hasItems("a", "b", "c");
         assertMatches("list containing all items (without matchers)", matcher2, asList("a", "b", "c"));
-        
+
         final Matcher> matcher3 = hasItems(equalTo("a"), equalTo("b"), equalTo("c"));
         assertMatches("list containing all items in any order", matcher3, asList("c", "b", "a"));
-        
+
         final Matcher> matcher4 = hasItems(equalTo("a"), equalTo("b"), equalTo("c"));
         assertMatches("list containing all items plus others", matcher4, asList("e", "c", "b", "a", "d"));
-        
+
         final Matcher> matcher5 = hasItems(equalTo("a"), equalTo("b"), equalTo("c"));
         assertDoesNotMatch("not match list unless it contains all items", matcher5, asList("e", "c", "b", "d")); // 'a' missing
     }
-    
+
     @Test public void
     reportsMismatchWithAReadableDescriptionForMultipleItems() {
         final Matcher> matcher = hasItems(3, 4);
-        
+
         assertMismatchDescription("a collection containing <4> mismatches were: [was <1>, was <2>, was <3>]",
                                   matcher, asList(1, 2, 3));
     }
@@ -90,7 +90,7 @@ private static Matcher mismatchable(final String string) {
         return new TypeSafeDiagnosingMatcher() {
             @Override
             protected boolean matchesSafely(String item, Description mismatchDescription) {
-                if (string.equals(item)) 
+                if (string.equals(item))
                     return true;
 
                 mismatchDescription.appendText("mismatched: " + item);
diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java
index 8366951c..6548e5f2 100644
--- a/hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java
+++ b/hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java
@@ -17,7 +17,7 @@ public final class IsNullTest {
     copesWithNullsAndUnknownTypes() {
         assertNullSafe(nullMatcher);
         assertUnknownTypeSafe(nullMatcher);
-        
+
         assertNullSafe(notNullMatcher);
         assertUnknownTypeSafe(notNullMatcher);
     }
@@ -26,11 +26,11 @@ public final class IsNullTest {
     evaluatesToTrueIfArgumentIsNull() {
         assertMatches(nullMatcher, null);
         assertDoesNotMatch(nullMatcher, new Object());
-        
+
         assertMatches(notNullMatcher, new Object());
         assertDoesNotMatch(notNullMatcher, null);
     }
-    
+
     @Test public void
     supportsStaticTyping() {
         requiresStringMatcher(nullValue(String.class));
diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java
index 9f8bcf3d..b83c9d5c 100644
--- a/hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java
+++ b/hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java
@@ -13,7 +13,7 @@ public final class IsSameTest {
     @Test public void
     copesWithNullsAndUnknownTypes() {
         Matcher matcher = sameInstance("irrelevant");
-        
+
         assertNullSafe(matcher);
         assertUnknownTypeSafe(matcher);
     }
diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsTest.java
index af60135c..8d5f9b72 100644
--- a/hamcrest/src/test/java/org/hamcrest/core/IsTest.java
+++ b/hamcrest/src/test/java/org/hamcrest/core/IsTest.java
@@ -13,7 +13,7 @@ public final class IsTest {
     @Test public void
     copesWithNullsAndUnknownTypes() {
         Matcher matcher = is("something");
-        
+
         assertNullSafe(matcher);
         assertUnknownTypeSafe(matcher);
     }
@@ -35,7 +35,7 @@ public final class IsTest {
     @Test public void
     providesConvenientShortcutForIsEqualTo() {
         final Matcher matcher = is("A");
-        
+
         assertMatches(matcher, "A");
         assertDoesNotMatch(is("A"), "B");
     }
diff --git a/hamcrest/src/test/java/org/hamcrest/core/SampleSubClass.java b/hamcrest/src/test/java/org/hamcrest/core/SampleSubClass.java
index bdaa160f..0c71224c 100644
--- a/hamcrest/src/test/java/org/hamcrest/core/SampleSubClass.java
+++ b/hamcrest/src/test/java/org/hamcrest/core/SampleSubClass.java
@@ -1,7 +1,7 @@
 package org.hamcrest.core;
 
 public class SampleSubClass extends SampleBaseClass {
-    
+
     public SampleSubClass(String value) {
         super(value);
     }

From 1414154f49355ba5fbbc742301b25934559dac3a Mon Sep 17 00:00:00 2001
From: John Patrick <142304+nhojpatrick@users.noreply.github.com>
Date: Sun, 13 Feb 2022 20:57:51 +0000
Subject: [PATCH 32/54] Java Code Style trailing whitespace org.hamcrest.number

---
 .../src/main/java/org/hamcrest/number/BigDecimalCloseTo.java  | 2 +-
 .../test/java/org/hamcrest/number/BigDecimalCloseToTest.java  | 4 ++--
 hamcrest/src/test/java/org/hamcrest/number/IsNanTest.java     | 2 +-
 .../test/java/org/hamcrest/number/OrderingComparisonTest.java | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/hamcrest/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java b/hamcrest/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java
index 4d997c7f..edb81755 100644
--- a/hamcrest/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java
+++ b/hamcrest/src/main/java/org/hamcrest/number/BigDecimalCloseTo.java
@@ -49,7 +49,7 @@ private BigDecimal actualDelta(BigDecimal item) {
    * is done by BigDecimals {@link java.math.BigDecimal#compareTo(java.math.BigDecimal)} method.
    * For example:
    * 
assertThat(new BigDecimal("1.03"), is(closeTo(new BigDecimal("1.0"), new BigDecimal("0.03"))))
- * + * * @param operand * the expected value of matching BigDecimals * @param error diff --git a/hamcrest/src/test/java/org/hamcrest/number/BigDecimalCloseToTest.java b/hamcrest/src/test/java/org/hamcrest/number/BigDecimalCloseToTest.java index c82e6f4e..52c4dcb6 100644 --- a/hamcrest/src/test/java/org/hamcrest/number/BigDecimalCloseToTest.java +++ b/hamcrest/src/test/java/org/hamcrest/number/BigDecimalCloseToTest.java @@ -15,7 +15,7 @@ protected Matcher createMatcher() { BigDecimal irrelevant = new BigDecimal("0.01"); return closeTo(irrelevant, irrelevant); } - + public void testEvaluatesToTrueIfArgumentIsEqualToABigDecimalWithinSomeError() { assertTrue(matcher.matches(new BigDecimal("1.0"))); assertTrue(matcher.matches(new BigDecimal("0.5"))); @@ -26,7 +26,7 @@ public void testEvaluatesToTrueIfArgumentIsEqualToABigDecimalWithinSomeError() { assertDoesNotMatch("number too small", matcher, new BigDecimal("0.0")); assertMismatchDescription("<0.0> differed by <0.5> more than delta <0.5>", matcher, new BigDecimal("0.0")); } - + public void testEvaluatesToTrueIfArgumentHasDifferentScale() { assertTrue(matcher.matches(new BigDecimal("1.000000"))); assertTrue(matcher.matches(new BigDecimal("0.500000"))); diff --git a/hamcrest/src/test/java/org/hamcrest/number/IsNanTest.java b/hamcrest/src/test/java/org/hamcrest/number/IsNanTest.java index b830b4b3..8cd6b759 100644 --- a/hamcrest/src/test/java/org/hamcrest/number/IsNanTest.java +++ b/hamcrest/src/test/java/org/hamcrest/number/IsNanTest.java @@ -11,7 +11,7 @@ public final class IsNanTest { @Test public void copesWithNullsAndUnknownTypes() { Matcher matcher = notANumber(); - + assertNullSafe(matcher); assertUnknownTypeSafe(matcher); } diff --git a/hamcrest/src/test/java/org/hamcrest/number/OrderingComparisonTest.java b/hamcrest/src/test/java/org/hamcrest/number/OrderingComparisonTest.java index 6e430a4d..5f0041a3 100644 --- a/hamcrest/src/test/java/org/hamcrest/number/OrderingComparisonTest.java +++ b/hamcrest/src/test/java/org/hamcrest/number/OrderingComparisonTest.java @@ -62,7 +62,7 @@ public void testComparesBigDecimalsWithDifferentScalesCorrectlyForIssue20() { assertThat(new BigDecimal(10), greaterThanOrEqualTo(new BigDecimal("10.0"))); assertThat(new BigDecimal("2"), comparesEqualTo(new BigDecimal("2.000"))); } - + public void testComparesCustomTypesWhoseCompareToReturnsValuesGreaterThatOne() { assertThat(new CustomInt(5), lessThan(new CustomInt(10))); } From f52954a6c697f6321d9d1703aab3399459ec000b Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:58:03 +0000 Subject: [PATCH 33/54] Java Code Style trailing whitespace org.hamcrest.object --- .../src/main/java/org/hamcrest/object/HasToString.java | 2 +- .../java/org/hamcrest/object/IsCompatibleType.java | 10 +++++----- .../src/main/java/org/hamcrest/object/IsEventFrom.java | 4 ++-- .../test/java/org/hamcrest/object/HasToStringTest.java | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/object/HasToString.java b/hamcrest/src/main/java/org/hamcrest/object/HasToString.java index c6331548..fac79ea1 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/HasToString.java +++ b/hamcrest/src/main/java/org/hamcrest/object/HasToString.java @@ -9,7 +9,7 @@ public class HasToString extends FeatureMatcher { public HasToString(Matcher toStringMatcher) { super(toStringMatcher, "with toString()", "toString()"); } - + @Override protected String featureValueOf(T actual) { return String.valueOf(actual); diff --git a/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java b/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java index 5d7ddd24..2484dd77 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java +++ b/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java @@ -6,26 +6,26 @@ public class IsCompatibleType extends TypeSafeMatcher> { private final Class type; - + public IsCompatibleType(Class type) { this.type = type; } - + @Override public boolean matchesSafely(Class cls) { return type.isAssignableFrom(cls); } - + @Override public void describeMismatchSafely(Class cls, Description mismatchDescription) { mismatchDescription.appendValue(cls.getName()); } - + @Override public void describeTo(Description description) { description.appendText("type < ").appendText(type.getName()); } - + /** * Creates a matcher of {@link Class} that matches when the specified baseType is * assignable from the examined class. diff --git a/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java b/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java index 101abba1..2cad5848 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java +++ b/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java @@ -25,7 +25,7 @@ public boolean matchesSafely(EventObject item, Description mismatchDescription) mismatchDescription.appendText("item type was " + item.getClass().getName()); return false; } - + if (!eventHasSameSource(item)) { mismatchDescription.appendText("source was ").appendValue(item.getSource()); return false; @@ -33,7 +33,7 @@ public boolean matchesSafely(EventObject item, Description mismatchDescription) return true; } - + private boolean eventHasSameSource(EventObject ev) { return ev.getSource() == source; } diff --git a/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java b/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java index 1ba0be15..80da27c2 100644 --- a/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java +++ b/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java @@ -19,11 +19,11 @@ public String toString() { @Test public void copesWithNullsAndUnknownTypes() { Matcher matcher = hasToString(equalTo("irrelevant")); - + assertNullSafe(matcher); assertUnknownTypeSafe(matcher); } - + @Test public void matchesWhenUtilisingANestedMatcher() { final Matcher matcher = hasToString(equalTo(TO_STRING_RESULT)); @@ -35,7 +35,7 @@ public String toString() { @Test public void matchesWhenUsingShortcutForHasToStringEqualTo() { final Matcher matcher = hasToString(TO_STRING_RESULT); - + assertMatches(matcher, TEST_OBJECT); assertDoesNotMatch(matcher, new Object()); } From a04fc20108d060d999c79b6bd3aab9eed55a2fea Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:58:16 +0000 Subject: [PATCH 34/54] Java Code Style trailing whitespace org.hamcrest.text --- .../hamcrest/text/IsEqualCompressingWhiteSpace.java | 4 ++-- .../java/org/hamcrest/text/IsEqualIgnoringCase.java | 2 +- .../org/hamcrest/text/StringContainsInOrder.java | 10 +++++----- .../java/org/hamcrest/text/IsBlankStringTest.java | 2 +- .../java/org/hamcrest/text/IsEmptyStringTest.java | 2 +- .../org/hamcrest/text/IsEqualIgnoringCaseTest.java | 12 ++++++------ .../org/hamcrest/text/StringContainsInOrderTest.java | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java b/hamcrest/src/main/java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java index 5618627e..544c203b 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java +++ b/hamcrest/src/main/java/org/hamcrest/text/IsEqualCompressingWhiteSpace.java @@ -29,12 +29,12 @@ protected String getString() { public boolean matchesSafely(String item) { return stripSpaces(string).equals(stripSpaces(item)); } - + @Override public void describeMismatchSafely(String item, Description mismatchDescription) { mismatchDescription.appendText("was ").appendValue(item); } - + @Override public void describeTo(Description description) { description.appendText("a string equal to ") diff --git a/hamcrest/src/main/java/org/hamcrest/text/IsEqualIgnoringCase.java b/hamcrest/src/main/java/org/hamcrest/text/IsEqualIgnoringCase.java index fccaa0cc..1ecba257 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/IsEqualIgnoringCase.java +++ b/hamcrest/src/main/java/org/hamcrest/text/IsEqualIgnoringCase.java @@ -30,7 +30,7 @@ public boolean matchesSafely(String item) { public void describeMismatchSafely(String item, Description mismatchDescription) { mismatchDescription.appendText("was ").appendValue(item); } - + @Override public void describeTo(Description description) { description.appendText("a string equal to ") diff --git a/hamcrest/src/main/java/org/hamcrest/text/StringContainsInOrder.java b/hamcrest/src/main/java/org/hamcrest/text/StringContainsInOrder.java index 43152dee..0b811def 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/StringContainsInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/text/StringContainsInOrder.java @@ -16,7 +16,7 @@ public StringContainsInOrder(Iterable substrings) { @Override public boolean matchesSafely(String s) { int fromIndex = 0; - + for (String substring : substrings) { fromIndex = s.indexOf(substring, fromIndex); if (fromIndex == -1) { @@ -24,22 +24,22 @@ public boolean matchesSafely(String s) { } fromIndex++; } - + return true; } - + @Override public void describeMismatchSafely(String item, Description mismatchDescription) { mismatchDescription.appendText("was \"").appendText(item).appendText("\""); } - + @Override public void describeTo(Description description) { description.appendText("a string containing ") .appendValueList("", ", ", "", substrings) .appendText(" in order"); } - + /** * Creates a matcher of {@link String} that matches when the examined string contains all of * the specified substrings, considering the order of their appearance. diff --git a/hamcrest/src/test/java/org/hamcrest/text/IsBlankStringTest.java b/hamcrest/src/test/java/org/hamcrest/text/IsBlankStringTest.java index 0ce043cd..42ce320a 100644 --- a/hamcrest/src/test/java/org/hamcrest/text/IsBlankStringTest.java +++ b/hamcrest/src/test/java/org/hamcrest/text/IsBlankStringTest.java @@ -12,7 +12,7 @@ public final class IsBlankStringTest { @Test public void copesWithNullsAndUnknownTypes() { Matcher matcher = blankString(); - + assertNullSafe(matcher); assertUnknownTypeSafe(matcher); } diff --git a/hamcrest/src/test/java/org/hamcrest/text/IsEmptyStringTest.java b/hamcrest/src/test/java/org/hamcrest/text/IsEmptyStringTest.java index a5139bd8..d0f42a82 100644 --- a/hamcrest/src/test/java/org/hamcrest/text/IsEmptyStringTest.java +++ b/hamcrest/src/test/java/org/hamcrest/text/IsEmptyStringTest.java @@ -12,7 +12,7 @@ public final class IsEmptyStringTest { @Test public void copesWithNullsAndUnknownTypes() { Matcher matcher = emptyString(); - + assertNullSafe(matcher); assertUnknownTypeSafe(matcher); } diff --git a/hamcrest/src/test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java b/hamcrest/src/test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java index 3763b348..da57720b 100644 --- a/hamcrest/src/test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java +++ b/hamcrest/src/test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java @@ -11,7 +11,7 @@ public final class IsEqualIgnoringCaseTest { @Test public void copesWithNullsAndUnknownTypes() { Matcher matcher = equalToIgnoringCase("irrelevant"); - + assertNullSafe(matcher); assertUnknownTypeSafe(matcher); } @@ -19,25 +19,25 @@ public final class IsEqualIgnoringCaseTest { @Test public void ignoresCaseOfCharsInString() { final Matcher matcher = equalToIgnoringCase("heLLo"); - + assertMatches(matcher, "HELLO"); assertMatches(matcher, "hello"); assertMatches(matcher, "HelLo"); assertDoesNotMatch(matcher, "bye"); } - @Test public void + @Test public void mismatchesIfAdditionalWhitespaceIsPresent() { final Matcher matcher = equalToIgnoringCase("heLLo"); - + assertDoesNotMatch(matcher, "hello "); assertDoesNotMatch(matcher, " hello"); } - @Test public void + @Test public void mismatchesNull() { final Matcher matcher = equalToIgnoringCase("heLLo"); - + assertDoesNotMatch(matcher, null); } diff --git a/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java index 86d3df8b..4532bc3f 100644 --- a/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java @@ -14,7 +14,7 @@ public class StringContainsInOrderTest extends AbstractMatcherTest { protected Matcher createMatcher() { return matcher; } - + public void testMatchesOnlyIfStringContainsGivenSubstringsInTheSameOrder() { assertMatches("substrings in order", matcher, "abcc"); assertMatches("substrings separated", matcher, "1a2b3c4c5"); @@ -26,7 +26,7 @@ public void testMatchesOnlyIfStringContainsGivenSubstringsInTheSameOrder() { assertDoesNotMatch("substring missing", matcher, "ac"); assertDoesNotMatch("empty string", matcher, ""); } - + public void testHasAReadableDescription() { assertDescription("a string containing \"a\", \"b\", \"c\", \"c\" in order", matcher); } From 6378ae1f9720af8ac9d164320ad92427b5cc8967 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:58:33 +0000 Subject: [PATCH 35/54] Java Code Style trailing whitespace org.hamcrest.internal --- .../org/hamcrest/internal/ArrayIterator.java | 6 ++--- .../internal/ReflectiveTypeFinder.java | 24 +++++++++---------- .../internal/SelfDescribingValue.java | 2 +- .../internal/SelfDescribingValueIterator.java | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java b/hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java index 5e497434..2e763e46 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java @@ -6,14 +6,14 @@ public class ArrayIterator implements Iterator { private final Object array; private int currentIndex = 0; - + public ArrayIterator(Object array) { if (!array.getClass().isArray()) { throw new IllegalArgumentException("not an array"); } this.array = array; } - + @Override public boolean hasNext() { return currentIndex < Array.getLength(array); @@ -23,7 +23,7 @@ public boolean hasNext() { public Object next() { return Array.get(array, currentIndex++); } - + @Override public void remove() { throw new UnsupportedOperationException("cannot remove items from an array"); diff --git a/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java b/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java index a3dfe754..2e42d7f8 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java @@ -1,25 +1,25 @@ /** - * The TypeSafe classes, and their descendants, need a mechanism to find out what type has been used as a parameter - * for the concrete matcher. Unfortunately, this type is lost during type erasure so we need to use reflection - * to get it back, by picking out the type of a known parameter to a known method. - * The catch is that, with bridging methods, this type is only visible in the class that actually implements + * The TypeSafe classes, and their descendants, need a mechanism to find out what type has been used as a parameter + * for the concrete matcher. Unfortunately, this type is lost during type erasure so we need to use reflection + * to get it back, by picking out the type of a known parameter to a known method. + * The catch is that, with bridging methods, this type is only visible in the class that actually implements * the expected method, so the ReflectiveTypeFinder needs to be applied to that class or a subtype. - * + * * For example, the abstract TypeSafeDiagnosingMatcher<T> defines an abstract method *
protected abstract boolean matchesSafely(T item, Description mismatchDescription);
* By default it uses new ReflectiveTypeFinder("matchesSafely", 2, 0); to find the * parameterised type. If we create a TypeSafeDiagnosingMatcher<String>, the type * finder will return String.class. - * - * A FeatureMatcher is an abstract subclass of TypeSafeDiagnosingMatcher. + * + * A FeatureMatcher is an abstract subclass of TypeSafeDiagnosingMatcher. * Although it has a templated implementation of matchesSafely(<T>, Description);, the * actual run-time signature of this is matchesSafely(Object, Description);. Instead, - * we must find the type by reflecting on the concrete implementation of + * we must find the type by reflecting on the concrete implementation of *
protected abstract U featureValueOf(T actual);
* a method which is declared in FeatureMatcher. - * - * In short, use this to extract a type from a method in the leaf class of a templated class hierarchy. - * + * + * In short, use this to extract a type from a method in the leaf class of a templated class hierarchy. + * * @author Steve Freeman * @author Nat Pryce */ @@ -37,7 +37,7 @@ public ReflectiveTypeFinder(String methodName, int expectedNumberOfParameters, i this.expectedNumberOfParameters = expectedNumberOfParameters; this.typedParameter = typedParameter; } - + public Class findExpectedType(Class fromClass) { for (Class c = fromClass; c != Object.class; c = c.getSuperclass()) { for (Method method : c.getDeclaredMethods()) { diff --git a/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValue.java b/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValue.java index 01bf942a..1c745d56 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValue.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValue.java @@ -5,7 +5,7 @@ public class SelfDescribingValue implements SelfDescribing { private T value; - + public SelfDescribingValue(T value) { this.value = value; } diff --git a/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java b/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java index 1905ecf5..538e3bda 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java @@ -6,11 +6,11 @@ public class SelfDescribingValueIterator implements Iterator { private Iterator values; - + public SelfDescribingValueIterator(Iterator values) { this.values = values; } - + @Override public boolean hasNext() { return values.hasNext(); From 0e6983a4195fc7e0249e8b033c6f4cd7096082e4 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:58:39 +0000 Subject: [PATCH 36/54] Java Code Style trailing whitespace org.hamcrest.io --- hamcrest/src/test/java/org/hamcrest/io/FileMatchersTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hamcrest/src/test/java/org/hamcrest/io/FileMatchersTest.java b/hamcrest/src/test/java/org/hamcrest/io/FileMatchersTest.java index b2e642db..80a90e48 100644 --- a/hamcrest/src/test/java/org/hamcrest/io/FileMatchersTest.java +++ b/hamcrest/src/test/java/org/hamcrest/io/FileMatchersTest.java @@ -19,11 +19,11 @@ protected void setUp() throws IOException { directory = File.createTempFile("myDir", ""); assertTrue("deleting " + directory, directory.delete()); assertTrue("mkdir " + directory, directory.mkdirs()); - + file = new File(directory, "myFile"); file.createNewFile(); } - + public void testAnExistingDirectory() { assertMatches("matches existing directory", FileMatchers.anExistingDirectory(), directory); assertDoesNotMatch("doesn't match existing file", FileMatchers.anExistingDirectory(), file); From cbaf1d257bee20f249c3aabe3390b2066443f88c Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:58:43 +0000 Subject: [PATCH 37/54] Java Code Style trailing whitespace org.hamcrest.xml --- hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java b/hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java index 2a00f9b1..3f8067b8 100644 --- a/hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java +++ b/hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java @@ -60,7 +60,7 @@ public Iterator getPrefixes(String namespaceURI) { @Test public void copesWithNullsAndUnknownTypes() { Matcher matcher = hasXPath("//irrelevant"); - + assertNullSafe(matcher); assertUnknownTypeSafe(matcher); } @@ -118,7 +118,7 @@ public Iterator getPrefixes(String namespaceURI) { describesItself() { assertDescription("an XML document with XPath /some/path \"Cheddar\"", hasXPath("/some/path", equalTo("Cheddar"))); - + assertDescription("an XML document with XPath /some/path", hasXPath("/some/path")); } From 43c0492ca0c01e48ffa47def87f487429b6bc0d9 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:54:15 +0000 Subject: [PATCH 38/54] Java Code Style squash multiple empty lines --- hamcrest/src/main/java/org/hamcrest/CoreMatchers.java | 1 - hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java | 1 - hamcrest/src/main/java/org/hamcrest/Description.java | 1 - hamcrest/src/main/java/org/hamcrest/MatcherAssert.java | 1 - .../src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java | 1 - .../src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java | 1 - .../src/main/java/org/hamcrest/collection/ArrayMatching.java | 1 - .../main/java/org/hamcrest/collection/IsIterableWithSize.java | 1 - hamcrest/src/main/java/org/hamcrest/core/IsAnything.java | 1 - .../src/main/java/org/hamcrest/core/IsCollectionContaining.java | 1 - hamcrest/src/main/java/org/hamcrest/core/IsEqual.java | 1 - hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java | 1 - .../src/main/java/org/hamcrest/core/IsIterableContaining.java | 1 - hamcrest/src/main/java/org/hamcrest/core/IsNot.java | 2 -- hamcrest/src/main/java/org/hamcrest/core/IsSame.java | 1 - .../main/java/org/hamcrest/internal/ReflectiveTypeFinder.java | 1 - hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java | 1 - hamcrest/src/main/java/org/hamcrest/number/IsNaN.java | 1 - hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java | 2 -- hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java | 1 - .../test/java/org/hamcrest/beans/HasPropertyWithValueTest.java | 1 - .../test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java | 2 -- .../java/org/hamcrest/collection/IsMapContainingKeyTest.java | 1 - .../java/org/hamcrest/collection/IsMapContainingValueTest.java | 1 - .../org/hamcrest/comparator/ComparatorMatcherBuilderTest.java | 1 - .../java/org/hamcrest/comparator/ComparatorMatcherTest.java | 1 - .../test/java/org/hamcrest/core/IsCollectionContainingTest.java | 2 -- hamcrest/src/test/java/org/hamcrest/core/IsInstanceOfTest.java | 1 - hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java | 1 - hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java | 1 - .../src/test/java/org/hamcrest/core/StringContainsTest.java | 1 - .../src/test/java/org/hamcrest/core/StringEndsWithTest.java | 1 - .../java/org/hamcrest/core/StringRegularExpressionTest.java | 1 - .../src/test/java/org/hamcrest/core/StringStartsWithTest.java | 1 - .../test/java/org/hamcrest/number/OrderingComparisonTest.java | 1 - hamcrest/src/test/java/org/hamcrest/object/IsEventFromTest.java | 1 - .../src/test/java/org/hamcrest/text/CharSequenceLengthTest.java | 1 - .../test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java | 1 - .../test/java/org/hamcrest/text/StringContainsInOrderTest.java | 1 - 39 files changed, 43 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/CoreMatchers.java b/hamcrest/src/main/java/org/hamcrest/CoreMatchers.java index d1f18024..3e2ce384 100644 --- a/hamcrest/src/main/java/org/hamcrest/CoreMatchers.java +++ b/hamcrest/src/main/java/org/hamcrest/CoreMatchers.java @@ -36,7 +36,6 @@ public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher. return org.hamcrest.core.AllOf.allOf(matchers); } - /** * Creates a matcher that matches if the examined object matches ANY of the specified matchers. * For example: diff --git a/hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java b/hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java index 8131514e..8f2cd049 100644 --- a/hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java @@ -1,6 +1,5 @@ package org.hamcrest; - /** * Utility class for writing one off matchers. * For example: diff --git a/hamcrest/src/main/java/org/hamcrest/Description.java b/hamcrest/src/main/java/org/hamcrest/Description.java index 24ed3d00..c23e099c 100644 --- a/hamcrest/src/main/java/org/hamcrest/Description.java +++ b/hamcrest/src/main/java/org/hamcrest/Description.java @@ -91,7 +91,6 @@ Description appendValueList(String start, String separator, String end, Description appendList(String start, String separator, String end, Iterable values); - public static final class NullDescription implements Description { @Override public Description appendDescriptionOf(SelfDescribing value) { diff --git a/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java b/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java index b15a7ecd..1480f750 100644 --- a/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java +++ b/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java @@ -1,6 +1,5 @@ package org.hamcrest; - public class MatcherAssert { public static void assertThat(T actual, Matcher matcher) { assertThat("", actual, matcher); diff --git a/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java b/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java index af1e2288..aa2a87e5 100644 --- a/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java @@ -2,7 +2,6 @@ import org.hamcrest.internal.ReflectiveTypeFinder; - /** * Convenient base class for Matchers that require a non-null value of a specific type * and that will report why the received value has been rejected. diff --git a/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java b/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java index ab723d86..0054bd24 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java @@ -46,7 +46,6 @@ public void describeTo(Description description) { } } - private boolean isCompatibleType(Object actual, Description mismatchDescription) { if (expectedBean.getClass().isAssignableFrom(actual.getClass())) { return true; diff --git a/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java b/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java index c800b50e..ed41c6bf 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java @@ -16,7 +16,6 @@ */ public class ArrayMatching { - /** * Creates a matcher for arrays that matches when the examined array contains at least one item * that is matched by the specified elementMatcher. Whilst matching, the traversal diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java index c0ed0120..95b489ab 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java @@ -13,7 +13,6 @@ public IsIterableWithSize(Matcher sizeMatcher) { super(sizeMatcher, "an iterable with size", "iterable size"); } - @Override protected Integer featureValueOf(Iterable actual) { int size = 0; diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsAnything.java b/hamcrest/src/main/java/org/hamcrest/core/IsAnything.java index b40ecaf2..7e23e689 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsAnything.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsAnything.java @@ -4,7 +4,6 @@ import org.hamcrest.Description; import org.hamcrest.Matcher; - /** * A matcher that always returns true. */ diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java b/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java index 76b82166..c6aab263 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java @@ -25,7 +25,6 @@ public void describeTo(Description description) { delegate.describeTo(description); } - /** * Creates a matcher for {@link Iterable}s that only matches when a single pass over the * examined {@link Iterable} yields at least one item that is matched by the specified diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java b/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java index 6b43e37d..9d887fd3 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java @@ -6,7 +6,6 @@ import java.lang.reflect.Array; - /** * Is the value equal to another value, as tested by the * {@link java.lang.Object#equals} invokedMethod? diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java b/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java index a285e915..2ef9eb88 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java @@ -4,7 +4,6 @@ import org.hamcrest.DiagnosingMatcher; import org.hamcrest.Matcher; - /** * Tests whether the value is an instance of a class. * Classes of basic types will be converted to the relevant "Object" classes diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java b/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java index 19a3b2cb..cb2b1c9b 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java @@ -54,7 +54,6 @@ public void describeTo(Description description) { .appendDescriptionOf(elementMatcher); } - /** * Creates a matcher for {@link Iterable}s that only matches when a single pass over the * examined {@link Iterable} yields at least one item that is matched by the specified diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsNot.java b/hamcrest/src/main/java/org/hamcrest/core/IsNot.java index 5351c9db..2100a729 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsNot.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsNot.java @@ -6,7 +6,6 @@ import static org.hamcrest.core.IsEqual.equalTo; - /** * Calculates the logical negation of a matcher. */ @@ -27,7 +26,6 @@ public void describeTo(Description description) { description.appendText("not ").appendDescriptionOf(matcher); } - /** * Creates a matcher that wraps an existing matcher, but inverts the logic by which * it will match. diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsSame.java b/hamcrest/src/main/java/org/hamcrest/core/IsSame.java index 6d58741a..c07eadf8 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsSame.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsSame.java @@ -4,7 +4,6 @@ import org.hamcrest.Description; import org.hamcrest.Matcher; - /** * Is the value the same object as another value? */ diff --git a/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java b/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java index 2e42d7f8..0c445de6 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java @@ -59,7 +59,6 @@ private boolean canObtainExpectedTypeFrom(Method method) { && !method.isSynthetic(); } - /** * @param method The method from which to extract * @return The type we're looking for diff --git a/hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java b/hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java index 6c5c9886..e055c5c8 100644 --- a/hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java +++ b/hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java @@ -6,7 +6,6 @@ import static java.lang.Math.abs; - /** * Is the value a number equal to a value within some range of * acceptable error? diff --git a/hamcrest/src/main/java/org/hamcrest/number/IsNaN.java b/hamcrest/src/main/java/org/hamcrest/number/IsNaN.java index 716c3f1e..ae87e28a 100644 --- a/hamcrest/src/main/java/org/hamcrest/number/IsNaN.java +++ b/hamcrest/src/main/java/org/hamcrest/number/IsNaN.java @@ -4,7 +4,6 @@ import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; - /** * Is the value a number actually not a number (NaN)? */ diff --git a/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java b/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java index 2cad5848..0fb8e859 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java +++ b/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java @@ -6,7 +6,6 @@ import java.util.EventObject; - /** * Tests if the value is an event announced by a specific object. */ @@ -33,7 +32,6 @@ public boolean matchesSafely(EventObject item, Description mismatchDescription) return true; } - private boolean eventHasSameSource(EventObject ev) { return ev.getSource() == source; } diff --git a/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java b/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java index 9e26ee4f..74f9b667 100644 --- a/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java +++ b/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java @@ -105,7 +105,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. diff --git a/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java index 61b1649b..cf9d0c71 100644 --- a/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java +++ b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java @@ -96,7 +96,6 @@ public void testExceptionsInBeanMethodsShouldBeReportedCorrectly() { new BeanWithBug()); } - public void testCanAccessAnAnonymousInnerClass() { class X implements IX { @Override diff --git a/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java b/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java index d448212a..58764650 100644 --- a/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java +++ b/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java @@ -11,7 +11,6 @@ public class SamePropertyValuesAsTest extends AbstractMatcherTest { private static final ExampleBean expectedBean = new ExampleBean("same", 1, aValue); private static final ExampleBean actualBean = new ExampleBean("same", 1, aValue); - @Override protected Matcher createMatcher() { return samePropertyValuesAs(expectedBean); @@ -67,7 +66,6 @@ public void test_can_ignore_all_properties() { differentBean); } - public void testDescribesItself() { assertDescription( "same property values as ExampleBean [intProperty: <1>, stringProperty: \"same\", valueProperty: ]", diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java index 1c4150fc..391016ca 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java @@ -34,7 +34,6 @@ public void testMatchesMapContainingKey() { assertMatches("Matches c", hasKey("c"), map); } - // No longer compiles // public void testMatchesMapContainingKeyWithNoGenerics() { // Map map = new HashMap(); diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java index 798eb90a..219e448e 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java @@ -1,6 +1,5 @@ package org.hamcrest.collection; - import org.hamcrest.AbstractMatcherTest; import org.hamcrest.Matcher; diff --git a/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherBuilderTest.java b/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherBuilderTest.java index 40cb3457..dfe3e4fa 100644 --- a/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherBuilderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherBuilderTest.java @@ -69,7 +69,6 @@ public void testComparesObjectsForLessThan() { assertThat(0, integerComparatorMatcherBuilder.lessThan(1)); } - public void testComparesObjectsForEquality() { assertThat(3, integerComparatorMatcherBuilder.comparesEqualTo(3)); assertThat("aa", stringComparatorMatcherBuilder.comparesEqualTo("aa")); diff --git a/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherTest.java index 5dcf5b3d..42270cc7 100644 --- a/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/comparator/ComparatorMatcherTest.java @@ -47,7 +47,6 @@ public void testComparesObjectsForLessThan() { assertThat(0, lessThan(1)); } - public void testComparesObjectsForEquality() { assertThat(3, comparesEqualTo(3)); assertThat("aa", comparesEqualTo("aa")); diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java index f2bd17e8..3ae17acd 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java @@ -32,7 +32,6 @@ public void testDoesNotMatchCollectionThatDoesntContainAnElementMatchingTheGiven final Matcher> matcher1 = hasItem(mismatchable("a")); assertMismatchDescription("mismatches were: [mismatched: b, mismatched: c]", matcher1, asList("b", "c")); - final Matcher> matcher2 = hasItem(equalTo("a")); assertMismatchDescription("was empty", matcher2, new ArrayList()); } @@ -81,7 +80,6 @@ public void testMatchesAllItemsInCollection() { asList("e", "c", "b", "d")); // 'a' missing } - private static Matcher mismatchable(final String string) { return new TypeSafeDiagnosingMatcher() { @Override diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsInstanceOfTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsInstanceOfTest.java index 39af41e7..df367b2f 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsInstanceOfTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsInstanceOfTest.java @@ -61,7 +61,6 @@ public final class IsInstanceOfTest { Integer anInteger = with(any(Integer.class)); } - private static T with(@SuppressWarnings("unused") Matcher matcher) { return null; } diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java index 6548e5f2..c407696c 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsNullTest.java @@ -7,7 +7,6 @@ import static org.hamcrest.core.IsNull.notNullValue; import static org.hamcrest.core.IsNull.nullValue; - public final class IsNullTest { private final Matcher nullMatcher = nullValue(); diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java index b83c9d5c..35b8bad3 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsSameTest.java @@ -7,7 +7,6 @@ import static org.hamcrest.core.IsSame.sameInstance; import static org.hamcrest.core.IsSame.theInstance; - public final class IsSameTest { @Test public void diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java index 5b5a166a..1e6fda6b 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java @@ -6,7 +6,6 @@ import static org.hamcrest.core.StringContains.containsString; import static org.hamcrest.core.StringContains.containsStringIgnoringCase; - public class StringContainsTest extends AbstractMatcherTest { static final String EXCERPT = "EXCERPT"; final Matcher stringContains = containsString(EXCERPT); diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringEndsWithTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringEndsWithTest.java index f482cbfa..0f007648 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/StringEndsWithTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/StringEndsWithTest.java @@ -6,7 +6,6 @@ import static org.hamcrest.core.StringEndsWith.endsWith; import static org.hamcrest.core.StringEndsWith.endsWithIgnoringCase; - public class StringEndsWithTest extends AbstractMatcherTest { static final String EXCERPT = "EXCERPT"; final Matcher stringEndsWith = endsWith(EXCERPT); diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringRegularExpressionTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringRegularExpressionTest.java index cf6be000..7271db97 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/StringRegularExpressionTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/StringRegularExpressionTest.java @@ -14,7 +14,6 @@ public class StringRegularExpressionTest extends AbstractMatcherTest { @Override protected Matcher createMatcher() { return matcher; } - public void testMatchingRegex() { assertMatches(matcher, "12"); assertDoesNotMatch(matcher, "abc"); diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringStartsWithTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringStartsWithTest.java index f093acb4..4f13ab30 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/StringStartsWithTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/StringStartsWithTest.java @@ -6,7 +6,6 @@ import static org.hamcrest.core.StringStartsWith.startsWith; import static org.hamcrest.core.StringStartsWith.startsWithIgnoringCase; - public class StringStartsWithTest extends AbstractMatcherTest { static final String EXCERPT = "EXCERPT"; final Matcher stringStartsWith = startsWith(EXCERPT); diff --git a/hamcrest/src/test/java/org/hamcrest/number/OrderingComparisonTest.java b/hamcrest/src/test/java/org/hamcrest/number/OrderingComparisonTest.java index 5f0041a3..41044b22 100644 --- a/hamcrest/src/test/java/org/hamcrest/number/OrderingComparisonTest.java +++ b/hamcrest/src/test/java/org/hamcrest/number/OrderingComparisonTest.java @@ -41,7 +41,6 @@ public void testComparesObjectsForLessThan() { assertThat(0, lessThan(1)); } - public void testComparesObjectsForEquality() { assertThat(3, comparesEqualTo(3)); assertThat("aa", comparesEqualTo("aa")); diff --git a/hamcrest/src/test/java/org/hamcrest/object/IsEventFromTest.java b/hamcrest/src/test/java/org/hamcrest/object/IsEventFromTest.java index 98ab4dea..b5a6bd04 100644 --- a/hamcrest/src/test/java/org/hamcrest/object/IsEventFromTest.java +++ b/hamcrest/src/test/java/org/hamcrest/object/IsEventFromTest.java @@ -8,7 +8,6 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.object.IsEventFrom.eventFrom; - public class IsEventFromTest extends AbstractMatcherTest { @Override diff --git a/hamcrest/src/test/java/org/hamcrest/text/CharSequenceLengthTest.java b/hamcrest/src/test/java/org/hamcrest/text/CharSequenceLengthTest.java index 76629465..a2dd8796 100644 --- a/hamcrest/src/test/java/org/hamcrest/text/CharSequenceLengthTest.java +++ b/hamcrest/src/test/java/org/hamcrest/text/CharSequenceLengthTest.java @@ -25,7 +25,6 @@ public void test_matchesExactLengthOf_CharSequence() { assertMismatchDescription("length was <6>", matcher, "aaaaaa"); } - public void test_matchesRelativeLengthOf_CharSequence() { final Matcher matcher = hasLength(lessThan(4)); assertMatches(matcher, "aaa"); diff --git a/hamcrest/src/test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java b/hamcrest/src/test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java index da57720b..15bdf94f 100644 --- a/hamcrest/src/test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java +++ b/hamcrest/src/test/java/org/hamcrest/text/IsEqualIgnoringCaseTest.java @@ -46,7 +46,6 @@ public final class IsEqualIgnoringCaseTest { equalToIgnoringCase(null); } - @Test public void describesItself() { final Matcher matcher = equalToIgnoringCase("heLLo"); diff --git a/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java index 4532bc3f..f7d13159 100644 --- a/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java @@ -6,7 +6,6 @@ import static java.util.Arrays.asList; import static org.hamcrest.text.StringContainsInOrder.stringContainsInOrder; - public class StringContainsInOrderTest extends AbstractMatcherTest { final StringContainsInOrder matcher = new StringContainsInOrder(asList("a", "b", "c", "c")); From 9dc17e7ab33a49611534cd2b211d888643a6194e Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:08:47 +0000 Subject: [PATCH 39/54] Java Code Style class/enum/interface padding org.hamcrest.integration --- .../src/main/java/org/hamcrest/JavaLangMatcherAssert.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java b/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java index 005f717e..bb0d5160 100644 --- a/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java +++ b/hamcrest-integration/src/main/java/org/hamcrest/JavaLangMatcherAssert.java @@ -10,6 +10,7 @@ * @author Neil Dunn */ public class JavaLangMatcherAssert { + private JavaLangMatcherAssert() {}; public static boolean that(T argument, Matcher matcher) { From 57252d10300b1e114d60fb52c88e79849d7d4695 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:09:15 +0000 Subject: [PATCH 40/54] Java Code Style class/enum/interface padding org.hamcrest --- hamcrest/src/main/java/org/hamcrest/Condition.java | 2 +- hamcrest/src/main/java/org/hamcrest/CustomMatcher.java | 1 + hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java | 1 + hamcrest/src/main/java/org/hamcrest/Description.java | 1 + hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java | 1 + hamcrest/src/main/java/org/hamcrest/MatcherAssert.java | 1 + hamcrest/src/main/java/org/hamcrest/SelfDescribing.java | 1 + hamcrest/src/main/java/org/hamcrest/StringDescription.java | 1 + .../src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java | 1 + hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java | 1 + .../src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java | 1 + hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java | 1 + hamcrest/src/test/java/org/hamcrest/TypeSafeMatcherTest.java | 1 + 13 files changed, 13 insertions(+), 1 deletion(-) diff --git a/hamcrest/src/main/java/org/hamcrest/Condition.java b/hamcrest/src/main/java/org/hamcrest/Condition.java index 922c1dfc..449314fe 100644 --- a/hamcrest/src/main/java/org/hamcrest/Condition.java +++ b/hamcrest/src/main/java/org/hamcrest/Condition.java @@ -9,8 +9,8 @@ * Based on https://github.com/npryce/maybe-java * @author Steve Freeman 2012 http://www.hamcrest.com */ - public abstract class Condition { + public static final NotMatched NOT_MATCHED = new NotMatched(); public interface Step { diff --git a/hamcrest/src/main/java/org/hamcrest/CustomMatcher.java b/hamcrest/src/main/java/org/hamcrest/CustomMatcher.java index c040d6be..3b5006e7 100644 --- a/hamcrest/src/main/java/org/hamcrest/CustomMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/CustomMatcher.java @@ -21,6 +21,7 @@ * @param The type of object being matched. */ public abstract class CustomMatcher extends BaseMatcher { + private final String fixedDescription; public CustomMatcher(String description) { diff --git a/hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java b/hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java index 8f2cd049..3becc146 100644 --- a/hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/CustomTypeSafeMatcher.java @@ -21,6 +21,7 @@ * @param The type of object being matched */ public abstract class CustomTypeSafeMatcher extends TypeSafeMatcher { + private final String fixedDescription; public CustomTypeSafeMatcher(String description) { diff --git a/hamcrest/src/main/java/org/hamcrest/Description.java b/hamcrest/src/main/java/org/hamcrest/Description.java index c23e099c..cd9b8615 100644 --- a/hamcrest/src/main/java/org/hamcrest/Description.java +++ b/hamcrest/src/main/java/org/hamcrest/Description.java @@ -7,6 +7,7 @@ * @see Matcher#describeTo(Description) */ public interface Description { + /** * A description that consumes input but does nothing. */ diff --git a/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java b/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java index 11f79606..5c7511ce 100644 --- a/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/FeatureMatcher.java @@ -10,6 +10,7 @@ * @param The type of the feature to be matched */ public abstract class FeatureMatcher extends TypeSafeDiagnosingMatcher { + private static final ReflectiveTypeFinder TYPE_FINDER = new ReflectiveTypeFinder("featureValueOf", 1, 0); private final Matcher subMatcher; private final String featureDescription; diff --git a/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java b/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java index 1480f750..c8bd9a50 100644 --- a/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java +++ b/hamcrest/src/main/java/org/hamcrest/MatcherAssert.java @@ -1,6 +1,7 @@ package org.hamcrest; public class MatcherAssert { + public static void assertThat(T actual, Matcher matcher) { assertThat("", actual, matcher); } diff --git a/hamcrest/src/main/java/org/hamcrest/SelfDescribing.java b/hamcrest/src/main/java/org/hamcrest/SelfDescribing.java index 86fb099a..01e343c3 100644 --- a/hamcrest/src/main/java/org/hamcrest/SelfDescribing.java +++ b/hamcrest/src/main/java/org/hamcrest/SelfDescribing.java @@ -4,6 +4,7 @@ * The ability of an object to describe itself. */ public interface SelfDescribing { + /** * Generates a description of the object. The description may be part of a * a description of a larger object of which this is just a component, so it diff --git a/hamcrest/src/main/java/org/hamcrest/StringDescription.java b/hamcrest/src/main/java/org/hamcrest/StringDescription.java index 0e3cf45d..76fd39f8 100644 --- a/hamcrest/src/main/java/org/hamcrest/StringDescription.java +++ b/hamcrest/src/main/java/org/hamcrest/StringDescription.java @@ -6,6 +6,7 @@ * A {@link Description} that is stored as a string. */ public class StringDescription extends BaseDescription { + private final Appendable out; public StringDescription() { diff --git a/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java b/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java index aa2a87e5..73edb835 100644 --- a/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java @@ -15,6 +15,7 @@ * @author Steve Freeman */ public abstract class TypeSafeDiagnosingMatcher extends BaseMatcher { + private static final ReflectiveTypeFinder TYPE_FINDER = new ReflectiveTypeFinder("matchesSafely", 2, 0); private final Class expectedType; diff --git a/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java b/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java index e8a028d2..d7f057b6 100644 --- a/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/TypeSafeMatcher.java @@ -13,6 +13,7 @@ * @author Nat Pryce */ public abstract class TypeSafeMatcher extends BaseMatcher { + private static final ReflectiveTypeFinder TYPE_FINDER = new ReflectiveTypeFinder("matchesSafely", 1, 0); final private Class expectedType; diff --git a/hamcrest/src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java index a4e2f060..3f71115a 100644 --- a/hamcrest/src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/CustomTypeSafeMatcherTest.java @@ -5,6 +5,7 @@ import static org.hamcrest.AbstractMatcherTest.*; public final class CustomTypeSafeMatcherTest { + private static final String STATIC_DESCRIPTION = "I match non empty strings"; private final Matcher customMatcher = new CustomTypeSafeMatcher(STATIC_DESCRIPTION) { diff --git a/hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java index b277c290..8248c997 100644 --- a/hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/FeatureMatcherTest.java @@ -7,6 +7,7 @@ import static org.junit.Assert.assertEquals; public final class FeatureMatcherTest { + private final FeatureMatcher resultMatcher = resultMatcher(); @Test public void diff --git a/hamcrest/src/test/java/org/hamcrest/TypeSafeMatcherTest.java b/hamcrest/src/test/java/org/hamcrest/TypeSafeMatcherTest.java index 2c62da36..0a9d7432 100644 --- a/hamcrest/src/test/java/org/hamcrest/TypeSafeMatcherTest.java +++ b/hamcrest/src/test/java/org/hamcrest/TypeSafeMatcherTest.java @@ -7,6 +7,7 @@ @SuppressWarnings("WeakerAccess") public final class TypeSafeMatcherTest { + private final Matcher matcher = new TypeSafeMatcherSubclass(); public static class TypeSafeMatcherSubclass extends TypeSafeMatcher { From 8a73d3201edd488114cde8bd88ed4e1593cdab70 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:09:28 +0000 Subject: [PATCH 41/54] Java Code Style class/enum/interface padding org.hamcrest.beans --- .../src/main/java/org/hamcrest/beans/HasPropertyWithValue.java | 1 + hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java | 1 + .../src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java | 1 + .../test/java/org/hamcrest/beans/HasPropertyWithValueTest.java | 1 + .../test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java | 1 + 5 files changed, 5 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java b/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java index a70e3096..2cfc122f 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java @@ -70,6 +70,7 @@ * @author cristcost at github */ public class HasPropertyWithValue extends TypeSafeDiagnosingMatcher { + private static final Condition.Step WITH_READ_METHOD = withReadMethod(); private final String propertyName; private final Matcher valueMatcher; diff --git a/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java b/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java index bd4f2c03..79a51298 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java @@ -14,6 +14,7 @@ * @since 1.1.0 */ public class PropertyUtil { + /** * Returns the description of the property with the provided * name on the provided object's interface. diff --git a/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java b/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java index 0054bd24..3928647b 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/SamePropertyValuesAs.java @@ -14,6 +14,7 @@ import static org.hamcrest.core.IsEqual.equalTo; public class SamePropertyValuesAs extends DiagnosingMatcher { + private final T expectedBean; private final Set propertyNames; private final List propertyMatchers; diff --git a/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java index cf9d0c71..bef5ac1e 100644 --- a/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java +++ b/hamcrest/src/test/java/org/hamcrest/beans/HasPropertyWithValueTest.java @@ -22,6 +22,7 @@ */ @SuppressWarnings("UnusedDeclaration") public class HasPropertyWithValueTest extends AbstractMatcherTest { + private final BeanWithoutInfo shouldMatch = new BeanWithoutInfo("is expected", true); private final BeanWithoutInfo shouldNotMatch = new BeanWithoutInfo("not expected", false); diff --git a/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java b/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java index 58764650..778259b2 100644 --- a/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java +++ b/hamcrest/src/test/java/org/hamcrest/beans/SamePropertyValuesAsTest.java @@ -7,6 +7,7 @@ @SuppressWarnings("WeakerAccess") public class SamePropertyValuesAsTest extends AbstractMatcherTest { + private static final Value aValue = new Value("expected"); private static final ExampleBean expectedBean = new ExampleBean("same", 1, aValue); private static final ExampleBean actualBean = new ExampleBean("same", 1, aValue); From 972dc775c99d300595554c8b5a42e15863b55a2e Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:09:46 +0000 Subject: [PATCH 42/54] Java Code Style class/enum/interface padding org.hamcrest.collection --- .../java/org/hamcrest/collection/ArrayAsIterableMatcher.java | 1 + .../src/main/java/org/hamcrest/collection/HasItemInArray.java | 1 + hamcrest/src/main/java/org/hamcrest/collection/IsArray.java | 1 + .../org/hamcrest/collection/IsArrayContainingInAnyOrder.java | 1 + .../java/org/hamcrest/collection/IsArrayContainingInOrder.java | 1 + .../src/main/java/org/hamcrest/collection/IsArrayWithSize.java | 1 + .../main/java/org/hamcrest/collection/IsCollectionWithSize.java | 1 + hamcrest/src/main/java/org/hamcrest/collection/IsIn.java | 1 + .../org/hamcrest/collection/IsIterableContainingInAnyOrder.java | 1 + .../org/hamcrest/collection/IsIterableContainingInOrder.java | 1 + .../src/main/java/org/hamcrest/collection/IsMapContaining.java | 1 + .../src/main/java/org/hamcrest/collection/IsMapWithSize.java | 1 + hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java | 1 + .../org/hamcrest/collection/IsIterableContainingInOrderTest.java | 1 + .../collection/IsIterableContainingInRelativeOrderTest.java | 1 + 15 files changed, 15 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/collection/ArrayAsIterableMatcher.java b/hamcrest/src/main/java/org/hamcrest/collection/ArrayAsIterableMatcher.java index ddeded7c..f6328bfa 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/ArrayAsIterableMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/ArrayAsIterableMatcher.java @@ -13,6 +13,7 @@ * @author Steve Freeman 2016 http://www.hamcrest.com */ public class ArrayAsIterableMatcher extends TypeSafeMatcher { + protected final TypeSafeDiagnosingMatcher> iterableMatcher; private final String message; protected final Collection> matchers; diff --git a/hamcrest/src/main/java/org/hamcrest/collection/HasItemInArray.java b/hamcrest/src/main/java/org/hamcrest/collection/HasItemInArray.java index 112b03f7..538d56ad 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/HasItemInArray.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/HasItemInArray.java @@ -12,6 +12,7 @@ * Matches if an array contains an item satisfying a nested matcher. */ public class HasItemInArray extends TypeSafeMatcher { + private final Matcher elementMatcher; private final TypeSafeDiagnosingMatcher> collectionMatcher; diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java index c0ed7d49..0080f442 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java @@ -11,6 +11,7 @@ * The array size must equal the number of element matchers. */ public class IsArray extends TypeSafeMatcher { + private final Matcher[] elementMatchers; public IsArray(Matcher[] elementMatchers) { diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java index d0b9a81e..1c2c8cc5 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java @@ -16,6 +16,7 @@ */ @Deprecated public class IsArrayContainingInAnyOrder extends TypeSafeMatcher { + private final IsIterableContainingInAnyOrder iterableMatcher; private final Collection> matchers; diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java index 0d7b051b..eaf5c0d7 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java @@ -15,6 +15,7 @@ * @deprecated As of release 2.1, replaced by {@link ArrayMatching}. */ public class IsArrayContainingInOrder extends TypeSafeMatcher { + private final Collection> matchers; private final IsIterableContainingInOrder iterableMatcher; diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java index 00c0f1a4..c0814cc0 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayWithSize.java @@ -10,6 +10,7 @@ * Matches if array size satisfies a nested matcher. */ public class IsArrayWithSize extends FeatureMatcher { + public IsArrayWithSize(Matcher sizeMatcher) { super(sizeMatcher, "an array with size","array size"); } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java index 2143046c..812d624c 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java @@ -11,6 +11,7 @@ * Matches if collection size satisfies a nested matcher. */ public class IsCollectionWithSize extends FeatureMatcher, Integer> { + public IsCollectionWithSize(Matcher sizeMatcher) { super(sizeMatcher, "a collection with size", "collection size"); } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java index f075b953..f18c2bd6 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIn.java @@ -8,6 +8,7 @@ import java.util.Collection; public class IsIn extends BaseMatcher { + private final Collection collection; public IsIn(Collection collection) { diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java index bb67e6f9..262a1263 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java @@ -12,6 +12,7 @@ import static org.hamcrest.core.IsEqual.equalTo; public class IsIterableContainingInAnyOrder extends TypeSafeDiagnosingMatcher> { + private final Collection> matchers; public IsIterableContainingInAnyOrder(Collection> matchers) { diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java index 0b5b2058..00b89ea7 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java @@ -12,6 +12,7 @@ import static org.hamcrest.collection.ArrayMatching.asEqualMatchers; public class IsIterableContainingInOrder extends TypeSafeDiagnosingMatcher> { + private final List> matchers; public IsIterableContainingInOrder(List> matchers) { diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java b/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java index 5d91acc9..ce8a3817 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java @@ -11,6 +11,7 @@ import static org.hamcrest.core.IsEqual.equalTo; public class IsMapContaining extends TypeSafeMatcher> { + private final Matcher keyMatcher; private final Matcher valueMatcher; diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java index b8cfbc18..b4670c32 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsMapWithSize.java @@ -11,6 +11,7 @@ * Matches if map size satisfies a nested matcher. */ public final class IsMapWithSize extends FeatureMatcher, Integer> { + @SuppressWarnings("WeakerAccess") public IsMapWithSize(Matcher sizeMatcher) { super(sizeMatcher, "a map with size", "map size"); diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java index 145db2b3..16333564 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java @@ -8,6 +8,7 @@ import java.util.Collection; public class IsInTest extends AbstractMatcherTest { + String[] elements = {"a", "b", "c"}; @Override diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java index ad5c17fe..be7f1728 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java @@ -13,6 +13,7 @@ @SuppressWarnings("unchecked") public class IsIterableContainingInOrderTest extends AbstractMatcherTest { + // temporary hack until the Java type system works private final Matcher> contains123 = contains(value(1), value(2), value(3)); diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInRelativeOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInRelativeOrderTest.java index 243947f1..1d4d83ee 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInRelativeOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInRelativeOrderTest.java @@ -13,6 +13,7 @@ @SuppressWarnings("unchecked") public class IsIterableContainingInRelativeOrderTest extends AbstractMatcherTest { + // temporary hack until the Java type system works private final Matcher> contains123 = containsInRelativeOrder(value(1), value(2), value(3)); From 6298db7d0f7fccb98eee95b8485823516e21908d Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:10:05 +0000 Subject: [PATCH 43/54] Java Code Style class/enum/interface padding org.hamcrest.core --- hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java | 1 + hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java | 1 + hamcrest/src/main/java/org/hamcrest/core/Every.java | 1 + hamcrest/src/main/java/org/hamcrest/core/Is.java | 1 + .../src/main/java/org/hamcrest/core/IsCollectionContaining.java | 1 + hamcrest/src/main/java/org/hamcrest/core/IsEqual.java | 1 + hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java | 1 + .../src/main/java/org/hamcrest/core/IsIterableContaining.java | 1 + hamcrest/src/main/java/org/hamcrest/core/IsNot.java | 1 + hamcrest/src/main/java/org/hamcrest/core/IsNull.java | 1 + hamcrest/src/main/java/org/hamcrest/core/IsSame.java | 1 + hamcrest/src/main/java/org/hamcrest/core/StringContains.java | 1 + hamcrest/src/main/java/org/hamcrest/core/StringEndsWith.java | 1 + hamcrest/src/main/java/org/hamcrest/core/StringStartsWith.java | 1 + hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java | 1 + .../test/java/org/hamcrest/core/IsCollectionContainingTest.java | 1 + hamcrest/src/test/java/org/hamcrest/core/SampleBaseClass.java | 1 + hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java | 1 + hamcrest/src/test/java/org/hamcrest/core/StringEndsWithTest.java | 1 + hamcrest/src/test/java/org/hamcrest/core/StringMatchingTest.java | 1 + .../test/java/org/hamcrest/core/StringRegularExpressionTest.java | 1 + .../src/test/java/org/hamcrest/core/StringStartsWithTest.java | 1 + 22 files changed, 22 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java b/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java index 1d7db2fb..dc882d79 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java @@ -12,6 +12,7 @@ * @param the type of matcher being combined. */ public class CombinableMatcher extends TypeSafeDiagnosingMatcher { + private final Matcher matcher; public CombinableMatcher(Matcher matcher) { diff --git a/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java b/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java index 18fa97b8..81abbca6 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java +++ b/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java @@ -12,6 +12,7 @@ * Provides a custom description to another matcher. */ public class DescribedAs extends BaseMatcher { + private final String descriptionTemplate; private final Matcher matcher; private final Object[] values; diff --git a/hamcrest/src/main/java/org/hamcrest/core/Every.java b/hamcrest/src/main/java/org/hamcrest/core/Every.java index 14997516..6e25fcda 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/Every.java +++ b/hamcrest/src/main/java/org/hamcrest/core/Every.java @@ -5,6 +5,7 @@ import org.hamcrest.TypeSafeDiagnosingMatcher; public class Every extends TypeSafeDiagnosingMatcher> { + private final Matcher matcher; public Every(Matcher matcher) { diff --git a/hamcrest/src/main/java/org/hamcrest/core/Is.java b/hamcrest/src/main/java/org/hamcrest/core/Is.java index 1a92955b..a23dd73c 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/Is.java +++ b/hamcrest/src/main/java/org/hamcrest/core/Is.java @@ -14,6 +14,7 @@ * vs. assertThat(cheese, is(equalTo(smelly))) */ public class Is extends BaseMatcher { + private final Matcher matcher; public Is(Matcher matcher) { diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java b/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java index c6aab263..fec50399 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsCollectionContaining.java @@ -9,6 +9,7 @@ */ @Deprecated public class IsCollectionContaining extends TypeSafeDiagnosingMatcher> { + private final IsIterableContaining delegate; public IsCollectionContaining(Matcher elementMatcher) { diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java b/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java index 9d887fd3..ddb91c50 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsEqual.java @@ -11,6 +11,7 @@ * {@link java.lang.Object#equals} invokedMethod? */ public class IsEqual extends BaseMatcher { + private final Object expectedValue; public IsEqual(T equalArg) { diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java b/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java index 2ef9eb88..0a984087 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsInstanceOf.java @@ -9,6 +9,7 @@ * Classes of basic types will be converted to the relevant "Object" classes */ public class IsInstanceOf extends DiagnosingMatcher { + private final Class expectedClass; private final Class matchableClass; diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java b/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java index cb2b1c9b..915e56c3 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsIterableContaining.java @@ -11,6 +11,7 @@ import static org.hamcrest.core.IsEqual.equalTo; public class IsIterableContaining extends TypeSafeDiagnosingMatcher> { + private final Matcher elementMatcher; public IsIterableContaining(Matcher elementMatcher) { diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsNot.java b/hamcrest/src/main/java/org/hamcrest/core/IsNot.java index 2100a729..bec81777 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsNot.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsNot.java @@ -10,6 +10,7 @@ * Calculates the logical negation of a matcher. */ public class IsNot extends BaseMatcher { + private final Matcher matcher; public IsNot(Matcher matcher) { diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsNull.java b/hamcrest/src/main/java/org/hamcrest/core/IsNull.java index 07045c91..e177e4ed 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsNull.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsNull.java @@ -10,6 +10,7 @@ * Is the value null? */ public class IsNull extends BaseMatcher { + @Override public boolean matches(Object o) { return o == null; diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsSame.java b/hamcrest/src/main/java/org/hamcrest/core/IsSame.java index c07eadf8..187d1020 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsSame.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsSame.java @@ -8,6 +8,7 @@ * Is the value the same object as another value? */ public class IsSame extends BaseMatcher { + private final T object; public IsSame(T object) { diff --git a/hamcrest/src/main/java/org/hamcrest/core/StringContains.java b/hamcrest/src/main/java/org/hamcrest/core/StringContains.java index dab7d4d9..3c3cb9cf 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/StringContains.java +++ b/hamcrest/src/main/java/org/hamcrest/core/StringContains.java @@ -6,6 +6,7 @@ * Tests if the argument is a string that contains a specific substring. */ public class StringContains extends SubstringMatcher { + public StringContains(String substring) { this(false, substring); } public StringContains(boolean ignoringCase, String substring) { diff --git a/hamcrest/src/main/java/org/hamcrest/core/StringEndsWith.java b/hamcrest/src/main/java/org/hamcrest/core/StringEndsWith.java index 96bbf29b..bff91577 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/StringEndsWith.java +++ b/hamcrest/src/main/java/org/hamcrest/core/StringEndsWith.java @@ -6,6 +6,7 @@ * Tests if the argument is a string that ends with a specific substring. */ public class StringEndsWith extends SubstringMatcher { + public StringEndsWith(String substring) { this(false, substring); } public StringEndsWith(boolean ignoringCase, String substring) { super("ending with", ignoringCase, substring); } diff --git a/hamcrest/src/main/java/org/hamcrest/core/StringStartsWith.java b/hamcrest/src/main/java/org/hamcrest/core/StringStartsWith.java index 7043fbff..0f145984 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/StringStartsWith.java +++ b/hamcrest/src/main/java/org/hamcrest/core/StringStartsWith.java @@ -6,6 +6,7 @@ * Tests if the argument is a string that starts with a specific substring. */ public class StringStartsWith extends SubstringMatcher { + public StringStartsWith(String substring) { this(false, substring); } public StringStartsWith(boolean ignoringCase, String substring) { super("starting with", ignoringCase, substring); } diff --git a/hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java b/hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java index 655c5120..aaa58053 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/CombinableTest.java @@ -9,6 +9,7 @@ import static org.hamcrest.core.IsNull.notNullValue; public final class CombinableTest { + private static final CombinableMatcher EITHER_3_OR_4 = CombinableMatcher.either(equalTo(3)).or(equalTo(4)); private static final CombinableMatcher NOT_3_AND_NOT_4 = CombinableMatcher.both(not(equalTo(3))).and(not(equalTo(4))); diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java index 3ae17acd..9e429e8e 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java @@ -16,6 +16,7 @@ import static org.hamcrest.core.IsEqual.equalTo; public class IsCollectionContainingTest extends AbstractMatcherTest { + @Override protected Matcher createMatcher() { return hasItem(equalTo("irrelevant")); diff --git a/hamcrest/src/test/java/org/hamcrest/core/SampleBaseClass.java b/hamcrest/src/test/java/org/hamcrest/core/SampleBaseClass.java index 29fa0186..39e50666 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/SampleBaseClass.java +++ b/hamcrest/src/test/java/org/hamcrest/core/SampleBaseClass.java @@ -1,6 +1,7 @@ package org.hamcrest.core; public class SampleBaseClass { + String value; public SampleBaseClass(String value) { diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java index 1e6fda6b..6bd9da71 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/StringContainsTest.java @@ -7,6 +7,7 @@ import static org.hamcrest.core.StringContains.containsStringIgnoringCase; public class StringContainsTest extends AbstractMatcherTest { + static final String EXCERPT = "EXCERPT"; final Matcher stringContains = containsString(EXCERPT); diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringEndsWithTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringEndsWithTest.java index 0f007648..71533215 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/StringEndsWithTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/StringEndsWithTest.java @@ -7,6 +7,7 @@ import static org.hamcrest.core.StringEndsWith.endsWithIgnoringCase; public class StringEndsWithTest extends AbstractMatcherTest { + static final String EXCERPT = "EXCERPT"; final Matcher stringEndsWith = endsWith(EXCERPT); diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringMatchingTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringMatchingTest.java index 7c2e5cd0..12049a61 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/StringMatchingTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/StringMatchingTest.java @@ -12,6 +12,7 @@ * @author Steve Freeman 2016 http://www.hamcrest.com */ public class StringMatchingTest { + @Rule public final ExpectedException thrown = ExpectedException.none(); @Test public void diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringRegularExpressionTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringRegularExpressionTest.java index 7271db97..1581d59a 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/StringRegularExpressionTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/StringRegularExpressionTest.java @@ -9,6 +9,7 @@ * @author Steve Freeman 2016 http://www.hamcrest.com */ public class StringRegularExpressionTest extends AbstractMatcherTest { + public final Matcher matcher = matchesRegex("^[0-9]+$"); @Override diff --git a/hamcrest/src/test/java/org/hamcrest/core/StringStartsWithTest.java b/hamcrest/src/test/java/org/hamcrest/core/StringStartsWithTest.java index 4f13ab30..fb762bfa 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/StringStartsWithTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/StringStartsWithTest.java @@ -7,6 +7,7 @@ import static org.hamcrest.core.StringStartsWith.startsWithIgnoringCase; public class StringStartsWithTest extends AbstractMatcherTest { + static final String EXCERPT = "EXCERPT"; final Matcher stringStartsWith = startsWith(EXCERPT); From 4d3fe7c378e307adb8a815acb7381fdc4f9264d7 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:10:21 +0000 Subject: [PATCH 44/54] Java Code Style class/enum/interface padding org.hamcrest.internal --- hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java | 1 + hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java | 1 + .../main/java/org/hamcrest/internal/ReflectiveTypeFinder.java | 1 + .../src/main/java/org/hamcrest/internal/SelfDescribingValue.java | 1 + .../java/org/hamcrest/internal/SelfDescribingValueIterator.java | 1 + 5 files changed, 5 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java b/hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java index 2e763e46..a92942e7 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/ArrayIterator.java @@ -4,6 +4,7 @@ import java.util.Iterator; public class ArrayIterator implements Iterator { + private final Object array; private int currentIndex = 0; diff --git a/hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java b/hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java index e5fa72f8..4ece6a9d 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java @@ -7,6 +7,7 @@ import java.util.List; public class NullSafety { + @SuppressWarnings("unchecked") public static List> nullSafe(Matcher[] itemMatchers) { final List> matchers = new ArrayList>(itemMatchers.length); diff --git a/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java b/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java index 0c445de6..fbf73871 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/ReflectiveTypeFinder.java @@ -28,6 +28,7 @@ import java.lang.reflect.Method; public class ReflectiveTypeFinder { + private final String methodName; private final int expectedNumberOfParameters; private final int typedParameter; diff --git a/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValue.java b/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValue.java index 1c745d56..6a5415cb 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValue.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValue.java @@ -4,6 +4,7 @@ import org.hamcrest.SelfDescribing; public class SelfDescribingValue implements SelfDescribing { + private T value; public SelfDescribingValue(T value) { diff --git a/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java b/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java index 538e3bda..ba79806e 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/SelfDescribingValueIterator.java @@ -5,6 +5,7 @@ import java.util.Iterator; public class SelfDescribingValueIterator implements Iterator { + private Iterator values; public SelfDescribingValueIterator(Iterator values) { From eb09b4a2fef43a57e4eb6bc874c16005b3c15268 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:10:41 +0000 Subject: [PATCH 45/54] Java Code Style class/enum/interface padding org.hamcrest.number --- hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java | 1 + .../src/test/java/org/hamcrest/number/BigDecimalCloseToTest.java | 1 + hamcrest/src/test/java/org/hamcrest/number/IsCloseToTest.java | 1 + 3 files changed, 3 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java b/hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java index e055c5c8..515f9e9e 100644 --- a/hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java +++ b/hamcrest/src/main/java/org/hamcrest/number/IsCloseTo.java @@ -11,6 +11,7 @@ * acceptable error? */ public class IsCloseTo extends TypeSafeMatcher { + private final double delta; private final double value; diff --git a/hamcrest/src/test/java/org/hamcrest/number/BigDecimalCloseToTest.java b/hamcrest/src/test/java/org/hamcrest/number/BigDecimalCloseToTest.java index 52c4dcb6..dd0ea4ec 100644 --- a/hamcrest/src/test/java/org/hamcrest/number/BigDecimalCloseToTest.java +++ b/hamcrest/src/test/java/org/hamcrest/number/BigDecimalCloseToTest.java @@ -8,6 +8,7 @@ import static org.hamcrest.number.BigDecimalCloseTo.closeTo; public class BigDecimalCloseToTest extends AbstractMatcherTest { + private final Matcher matcher = closeTo(new BigDecimal("1.0"), new BigDecimal("0.5")); @Override diff --git a/hamcrest/src/test/java/org/hamcrest/number/IsCloseToTest.java b/hamcrest/src/test/java/org/hamcrest/number/IsCloseToTest.java index 8b0e244b..d06822f6 100644 --- a/hamcrest/src/test/java/org/hamcrest/number/IsCloseToTest.java +++ b/hamcrest/src/test/java/org/hamcrest/number/IsCloseToTest.java @@ -6,6 +6,7 @@ import static org.hamcrest.number.IsCloseTo.closeTo; public class IsCloseToTest extends AbstractMatcherTest { + private final Matcher matcher = closeTo(1.0d, 0.5d); @Override From 541cf0b5395ffc321e482fc6ee09d2754398bead Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:10:59 +0000 Subject: [PATCH 46/54] Java Code Style class/enum/interface padding org.hamcrest.object --- hamcrest/src/main/java/org/hamcrest/object/HasEqualValues.java | 1 + hamcrest/src/main/java/org/hamcrest/object/HasToString.java | 1 + hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java | 1 + hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java | 1 + .../src/test/java/org/hamcrest/object/HasEqualsValuesTest.java | 1 + hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java | 1 + .../src/test/java/org/hamcrest/object/IsCompatibleTypeTest.java | 1 + .../src/test/java/org/hamcrest/object/MatchesPatternTest.java | 1 + 8 files changed, 8 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/object/HasEqualValues.java b/hamcrest/src/main/java/org/hamcrest/object/HasEqualValues.java index fb871a5f..2d0479cd 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/HasEqualValues.java +++ b/hamcrest/src/main/java/org/hamcrest/object/HasEqualValues.java @@ -13,6 +13,7 @@ import static java.lang.String.format; public class HasEqualValues extends TypeSafeDiagnosingMatcher { + private final T expectedObject; private final List fieldMatchers; diff --git a/hamcrest/src/main/java/org/hamcrest/object/HasToString.java b/hamcrest/src/main/java/org/hamcrest/object/HasToString.java index fac79ea1..51942654 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/HasToString.java +++ b/hamcrest/src/main/java/org/hamcrest/object/HasToString.java @@ -6,6 +6,7 @@ import static org.hamcrest.core.IsEqual.equalTo; public class HasToString extends FeatureMatcher { + public HasToString(Matcher toStringMatcher) { super(toStringMatcher, "with toString()", "toString()"); } diff --git a/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java b/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java index 2484dd77..01f81e35 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java +++ b/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java @@ -5,6 +5,7 @@ import org.hamcrest.TypeSafeMatcher; public class IsCompatibleType extends TypeSafeMatcher> { + private final Class type; public IsCompatibleType(Class type) { diff --git a/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java b/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java index 0fb8e859..5ab8b306 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java +++ b/hamcrest/src/main/java/org/hamcrest/object/IsEventFrom.java @@ -10,6 +10,7 @@ * Tests if the value is an event announced by a specific object. */ public class IsEventFrom extends TypeSafeDiagnosingMatcher { + private final Class eventClass; private final Object source; diff --git a/hamcrest/src/test/java/org/hamcrest/object/HasEqualsValuesTest.java b/hamcrest/src/test/java/org/hamcrest/object/HasEqualsValuesTest.java index f6cfaed3..96be09cd 100644 --- a/hamcrest/src/test/java/org/hamcrest/object/HasEqualsValuesTest.java +++ b/hamcrest/src/test/java/org/hamcrest/object/HasEqualsValuesTest.java @@ -5,6 +5,7 @@ @SuppressWarnings("WeakerAccess") public class HasEqualsValuesTest extends AbstractMatcherTest { + private static final WithPublicFields WITH_PUBLIC_FIELDS = new WithPublicFields('x', 666, "a string"); private static final HasEqualValues WITH_PUBLIC_FIELDS_MATCHER = new HasEqualValues<>(WITH_PUBLIC_FIELDS); diff --git a/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java b/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java index 80da27c2..0e63a186 100644 --- a/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java +++ b/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java @@ -8,6 +8,7 @@ import static org.hamcrest.object.HasToString.hasToString; public final class HasToStringTest { + private static final String TO_STRING_RESULT = "toString result"; private static final Object TEST_OBJECT = new Object() { @Override diff --git a/hamcrest/src/test/java/org/hamcrest/object/IsCompatibleTypeTest.java b/hamcrest/src/test/java/org/hamcrest/object/IsCompatibleTypeTest.java index a90c4931..33169e34 100644 --- a/hamcrest/src/test/java/org/hamcrest/object/IsCompatibleTypeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/object/IsCompatibleTypeTest.java @@ -7,6 +7,7 @@ import static org.hamcrest.object.IsCompatibleType.typeCompatibleWith; public class IsCompatibleTypeTest extends AbstractMatcherTest { + static class BaseClass { } diff --git a/hamcrest/src/test/java/org/hamcrest/object/MatchesPatternTest.java b/hamcrest/src/test/java/org/hamcrest/object/MatchesPatternTest.java index 6e2ceb97..c8ec40dd 100644 --- a/hamcrest/src/test/java/org/hamcrest/object/MatchesPatternTest.java +++ b/hamcrest/src/test/java/org/hamcrest/object/MatchesPatternTest.java @@ -10,6 +10,7 @@ import static org.junit.Assert.assertThat; public class MatchesPatternTest { + @Test public void copesWithNullsAndUnknownTypes() { Matcher matcher = new MatchesPattern(Pattern.compile(".")); From 3a4aa576ef01dca5c966aebac03ac728c2fd0e1b Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:11:16 +0000 Subject: [PATCH 47/54] Java Code Style class/enum/interface padding org.hamcrest.text --- hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java | 1 + hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java | 1 + hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java | 1 + .../src/main/java/org/hamcrest/text/StringContainsInOrder.java | 1 + .../test/java/org/hamcrest/text/StringContainsInOrderTest.java | 1 + 5 files changed, 5 insertions(+) diff --git a/hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java b/hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java index 0d02cba5..c026fac2 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java +++ b/hamcrest/src/main/java/org/hamcrest/text/IsBlankString.java @@ -13,6 +13,7 @@ * Matches blank Strings (and null). */ public final class IsBlankString extends TypeSafeMatcher { + private static final IsBlankString BLANK_INSTANCE = new IsBlankString(); @SuppressWarnings("unchecked") private static final Matcher NULL_OR_BLANK_INSTANCE = anyOf(nullValue(), BLANK_INSTANCE); diff --git a/hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java b/hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java index bb897f1d..1c1c3759 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java +++ b/hamcrest/src/main/java/org/hamcrest/text/IsEmptyString.java @@ -11,6 +11,7 @@ * Matches empty Strings (and null). */ public final class IsEmptyString extends TypeSafeMatcher { + private static final IsEmptyString INSTANCE = new IsEmptyString(); @SuppressWarnings("unchecked") private static final Matcher NULL_OR_EMPTY_INSTANCE = anyOf(nullValue(), INSTANCE); diff --git a/hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java b/hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java index 28c5a48d..2b3ebefe 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java +++ b/hamcrest/src/main/java/org/hamcrest/text/MatchesPattern.java @@ -7,6 +7,7 @@ import java.util.regex.Pattern; public class MatchesPattern extends TypeSafeMatcher { + private final Pattern pattern; public MatchesPattern(Pattern pattern) { diff --git a/hamcrest/src/main/java/org/hamcrest/text/StringContainsInOrder.java b/hamcrest/src/main/java/org/hamcrest/text/StringContainsInOrder.java index 0b811def..9e2ec30a 100644 --- a/hamcrest/src/main/java/org/hamcrest/text/StringContainsInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/text/StringContainsInOrder.java @@ -7,6 +7,7 @@ import java.util.Arrays; public class StringContainsInOrder extends TypeSafeMatcher { + private final Iterable substrings; public StringContainsInOrder(Iterable substrings) { diff --git a/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java index f7d13159..64a54e64 100644 --- a/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java +++ b/hamcrest/src/test/java/org/hamcrest/text/StringContainsInOrderTest.java @@ -7,6 +7,7 @@ import static org.hamcrest.text.StringContainsInOrder.stringContainsInOrder; public class StringContainsInOrderTest extends AbstractMatcherTest { + final StringContainsInOrder matcher = new StringContainsInOrder(asList("a", "b", "c", "c")); @Override From d298634c0893f1b8d1bbfd97a996d8c0285e2e2d Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:11:21 +0000 Subject: [PATCH 48/54] Java Code Style class/enum/interface padding org.hamcrest.xml --- hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java b/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java index 74f9b667..db247f1b 100644 --- a/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java +++ b/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java @@ -22,6 +22,7 @@ * @author Steve Freeman */ public class HasXPath extends TypeSafeDiagnosingMatcher { + public static final NamespaceContext NO_NAMESPACE_CONTEXT = null; private static final IsAnything WITH_ANY_CONTENT = new IsAnything(""); private static final Condition.Step NODE_EXISTS = nodeExists(); From 5d2da0731d2fe5dc5e22c9923a118e63967f919b Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:17:05 +0000 Subject: [PATCH 49/54] Java Code Style --- .../java/org/hamcrest/beans/HasPropertyWithValue.java | 4 ++-- .../java/org/hamcrest/collection/IsMapContaining.java | 6 +++--- hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java | 2 +- .../org/hamcrest/collection/IsMapContainingKeyTest.java | 8 ++++---- .../java/org/hamcrest/collection/IsMapContainingTest.java | 2 +- .../org/hamcrest/collection/IsMapContainingValueTest.java | 6 +++--- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java b/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java index 2cfc122f..7c3de8a8 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/HasPropertyWithValue.java @@ -71,7 +71,7 @@ */ public class HasPropertyWithValue extends TypeSafeDiagnosingMatcher { - private static final Condition.Step WITH_READ_METHOD = withReadMethod(); + private static final Condition.Step WITH_READ_METHOD = withReadMethod(); private final String propertyName; private final Matcher valueMatcher; private final String messageFormat; @@ -136,7 +136,7 @@ private static Matcher nastyGenericsWorkaround(Matcher valueMatcher) return (Matcher) valueMatcher; } - private static Condition.Step withReadMethod() { + private static Condition.Step withReadMethod() { return new Condition.Step() { @Override public Condition apply(PropertyDescriptor property, Description mismatch) { diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java b/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java index ce8a3817..d81dbd9a 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java @@ -10,7 +10,7 @@ import static org.hamcrest.core.IsAnything.anything; import static org.hamcrest.core.IsEqual.equalTo; -public class IsMapContaining extends TypeSafeMatcher> { +public class IsMapContaining extends TypeSafeMatcher> { private final Matcher keyMatcher; private final Matcher valueMatcher; @@ -61,7 +61,7 @@ public void describeTo(Description description) { * the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entry * @return The matcher. */ - public static Matcher> hasEntry(Matcher keyMatcher, Matcher valueMatcher) { + public static Matcher> hasEntry(Matcher keyMatcher, Matcher valueMatcher) { return new IsMapContaining<>(keyMatcher, valueMatcher); } @@ -82,7 +82,7 @@ public static Matcher> hasEntry(Matcher Matcher> hasEntry(K key, V value) { + public static Matcher> hasEntry(K key, V value) { return new IsMapContaining<>(equalTo(key), equalTo(value)); } diff --git a/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java b/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java index db247f1b..a957fd6e 100644 --- a/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java +++ b/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java @@ -25,7 +25,7 @@ public class HasXPath extends TypeSafeDiagnosingMatcher { public static final NamespaceContext NO_NAMESPACE_CONTEXT = null; private static final IsAnything WITH_ANY_CONTENT = new IsAnything(""); - private static final Condition.Step NODE_EXISTS = nodeExists(); + private static final Condition.Step NODE_EXISTS = nodeExists(); private final Matcher valueMatcher; private final XPathExpression compiledXPath; private final String xpathString; diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java index 391016ca..b6c4f4bc 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java @@ -18,14 +18,14 @@ protected Matcher createMatcher() { } public void testMatchesSingletonMapContainingKey() { - Map map = new HashMap(); + Map map = new HashMap(); map.put("a", 1); assertMatches("Matches single key", hasKey("a"), map); } public void testMatchesMapContainingKey() { - Map map = new HashMap(); + Map map = new HashMap(); map.put("a", 1); map.put("b", 2); map.put("c", 3); @@ -69,11 +69,11 @@ public void testHasReadableDescription() { } public void testDoesNotMatchEmptyMap() { - assertMismatchDescription("map was []", hasKey("Foo"), new HashMap()); + assertMismatchDescription("map was []", hasKey("Foo"), new HashMap()); } public void testDoesNotMatchMapMissingKey() { - Map map = new TreeMap(); + Map map = new TreeMap(); map.put("a", 1); map.put("b", 2); map.put("c", 3); diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingTest.java index 2f9e0880..9f842585 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingTest.java @@ -19,7 +19,7 @@ protected Matcher createMatcher() { } public void testMatchesMapContainingMatchingKeyAndValue() { - Map map = new TreeMap<>(); + Map map = new TreeMap<>(); map.put("a", 1); map.put("b", 2); diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java index 219e448e..523f56aa 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java @@ -21,19 +21,19 @@ public void testHasReadableDescription() { } public void testDoesNotMatchEmptyMap() { - Map map = new HashMap(); + Map map = new HashMap(); assertMismatchDescription("map was []", hasValue(1), map); } public void testMatchesSingletonMapContainingValue() { - Map map = new HashMap(); + Map map = new HashMap(); map.put("a", 1); assertMatches("Singleton map", hasValue(1), map); } public void testMatchesMapContainingValue() { - Map map = new TreeMap(); + Map map = new TreeMap(); map.put("a", 1); map.put("b", 2); map.put("c", 3); From 5d76642543b4d8c3e5f1b4cd4684d31be0724fde Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:17:21 +0000 Subject: [PATCH 50/54] Java Code Style )whitespace{ --- hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java | 2 +- hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java b/hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java index fb531645..892a94ef 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/AllOfTest.java @@ -64,7 +64,7 @@ public final class AllOfTest { } @Test public void - varargs(){ + varargs() { assertThat("the text!", new AllOf<>(startsWith("the"), containsString("text"), endsWith("!"))); } diff --git a/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java b/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java index 73c24ca1..2cf7c2a8 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/AnyOfTest.java @@ -56,7 +56,7 @@ public final class AnyOfTest { } @Test public void - varargs(){ + varargs() { assertThat("the text!", new AnyOf<>(startsWith("the"), endsWith("."))); } From 73d89b233cd8a51efbaf4d2e6d7811609b92d1d6 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:59:29 +0000 Subject: [PATCH 51/54] Java 5 Clean Up Remove Unnecessary Boxing --- .../java/org/hamcrest/core/IsCollectionContainingTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java index 9e429e8e..0b98e881 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java @@ -48,9 +48,9 @@ public void testHasAReadableDescription() { public void testCanMatchItemWhenCollectionHoldsSuperclass() // Issue 24 { final Set s = new HashSet(); - s.add(Integer.valueOf(2)); - assertThat(s, new IsCollectionContaining(new IsEqual(Integer.valueOf(2)))); - assertThat(s, IsCollectionContaining.hasItem(Integer.valueOf(2))); + s.add(2); + assertThat(s, new IsCollectionContaining(new IsEqual(2))); + assertThat(s, IsCollectionContaining.hasItem(2)); } @SuppressWarnings("unchecked") From 0ba3f59b81ca6c886a2064b993b6025f84bf9c57 Mon Sep 17 00:00:00 2001 From: "andremoniy@gmail.com" Date: Sun, 3 Mar 2019 19:25:37 +0100 Subject: [PATCH 52/54] IsUnmodifiableCollection matcher feature #249 --- .../collection/IsUnmodifiableCollection.java | 176 ++++++++++++++++++ .../IsUnmodifiableCollectionTest.java | 140 ++++++++++++++ 2 files changed, 316 insertions(+) create mode 100644 hamcrest/src/main/java/org/hamcrest/collection/IsUnmodifiableCollection.java create mode 100644 hamcrest/src/test/java/org/hamcrest/collection/IsUnmodifiableCollectionTest.java diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsUnmodifiableCollection.java b/hamcrest/src/main/java/org/hamcrest/collection/IsUnmodifiableCollection.java new file mode 100644 index 00000000..ecc6184d --- /dev/null +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsUnmodifiableCollection.java @@ -0,0 +1,176 @@ +package org.hamcrest.collection; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; + +import java.lang.reflect.Array; +import java.lang.reflect.Constructor; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Matches if collection is truly unmodifiable + */ +public class IsUnmodifiableCollection extends TypeSafeDiagnosingMatcher> { + + private static final Map DEFAULT_COLLECTIONS = new HashMap<>(); + + static { + final List list = Arrays.asList("a", "b", "c"); + DEFAULT_COLLECTIONS.put(Collection.class, list); + DEFAULT_COLLECTIONS.put(List.class, list); + DEFAULT_COLLECTIONS.put(Set.class, new HashSet<>(list)); + } + + @SuppressWarnings("unchecked") + @Override + protected boolean matchesSafely(final Collection collection, final Description mismatchDescription) { + final Class collectionClass = collection.getClass(); + final Collection item = getInstanceOfType(collectionClass); + if (item == null) { + throw failedToInstantiateItem(collectionClass, null); + } + final Object testObject = new Object(); + final Set singletonList = Collections.singleton(testObject); + + try { + item.add(testObject); + mismatchDescription.appendText("was able to add a value into the collection"); + return false; + } catch (Exception ignore) { + } + + try { + item.addAll(singletonList); + mismatchDescription.appendText("was able to perform addAll on the collection"); + return false; + } catch (Exception ignore) { + } + + try { + item.remove(testObject); + mismatchDescription.appendText("was able to remove a value from the collection"); + return false; + } catch (Exception ignore) { + } + + try { + item.removeAll(singletonList); + mismatchDescription.appendText("was able to perform removeAll on the collection"); + return false; + } catch (Exception ignore) { + } + + try { + item.retainAll(singletonList); + mismatchDescription.appendText("was able to perform retainAll on the collection"); + return false; + } catch (Exception ignore) { + } + + try { + item.clear(); + mismatchDescription.appendText("was able to clear the collection"); + return false; + } catch (Exception ignore) { + } + + return true; + } + + + @SuppressWarnings("unchecked") + private T getInstanceOfType(final Class clazz) { + Exception lastException = null; + + if (clazz.isArray()) { + return (T) Array.newInstance(clazz, 0); + } + + if (clazz.isPrimitive()) { + if (Byte.TYPE.isAssignableFrom(clazz)) { + return (T) Byte.valueOf((byte) 1); + } + if (Short.TYPE.isAssignableFrom(clazz)) { + return (T) Short.valueOf((short) 1); + } + if (Integer.TYPE.isAssignableFrom(clazz)) { + return (T) Integer.valueOf(1); + } + if (Long.TYPE.isAssignableFrom(clazz)) { + return (T) Long.valueOf(1L); + } + if (Float.TYPE.isAssignableFrom(clazz)) { + return (T) Float.valueOf(1L); + } + if (Double.TYPE.isAssignableFrom(clazz)) { + return (T) Double.valueOf(1L); + } + if (Boolean.TYPE.isAssignableFrom(clazz)) { + return (T) Boolean.valueOf(true); + } + if (Character.TYPE.isAssignableFrom(clazz)) { + return (T) Character.valueOf(' '); + } + } + + if (clazz.isInterface()) { + Object defaultCollection = DEFAULT_COLLECTIONS.get(clazz); + if (defaultCollection != null) { + return (T) defaultCollection; + } + return null; + } + + // For the most part of implementations there probably won't be any default constructor + final Constructor[] declaredConstructors = clazz.getDeclaredConstructors(); + // First take constructor with fewer number of arguments + Arrays.sort(declaredConstructors, new Comparator>() { + @Override + public int compare(Constructor o1, Constructor o2) { + return Integer.compare(o2.getParameterTypes().length, o1.getParameterTypes().length); + } + }); + for (Constructor declaredConstructor : declaredConstructors) { + declaredConstructor.setAccessible(true); + final int parametersNumber = declaredConstructor.getParameterTypes().length; + + Object[] arguments = new Object[parametersNumber]; + for (int argumentIndex = 0; argumentIndex < arguments.length; argumentIndex++) { + arguments[argumentIndex] = getInstanceOfType(declaredConstructor.getParameterTypes()[argumentIndex]); + } + try { + return (T) declaredConstructor.newInstance(arguments); + } catch (Exception e) { + lastException = e; + } + + } + throw failedToInstantiateItem(clazz, lastException); + } + + private IllegalStateException failedToInstantiateItem(Class clazz, Exception e) { + return new IllegalStateException("Failed to create an instance of <" + clazz + "> class.", e); + } + + @Override + public void describeTo(Description description) { + description.appendText("Expected to be unmodifiable collection, but "); + } + + /** + * Creates matcher that matches when collection is truly unmodifiable + */ + public static Matcher> isUnmodifiable() { + return new IsUnmodifiableCollection<>(); + } + +} diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsUnmodifiableCollectionTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsUnmodifiableCollectionTest.java new file mode 100644 index 00000000..2d822ab9 --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsUnmodifiableCollectionTest.java @@ -0,0 +1,140 @@ +package org.hamcrest.collection; + +import org.hamcrest.AbstractMatcherTest; +import org.hamcrest.Matcher; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; + +import static org.hamcrest.collection.IsUnmodifiableCollection.isUnmodifiable; + +public class IsUnmodifiableCollectionTest extends AbstractMatcherTest { + + @Override + protected Matcher createMatcher() { + return isUnmodifiable(); + } + + public void testMatchesUnmodifiableList() { + assertMatches("truly unmodifiable list", isUnmodifiable(), Collections.unmodifiableList(Collections.emptyList())); + } + + public void testMatchesUnmodifiableSet() { + assertMatches("truly unmodifiable set", isUnmodifiable(), Collections.unmodifiableSet(Collections.emptySet())); + } + + public void testMatchesUnmodifiableCollection() { + assertMatches("truly unmodifiable collection", isUnmodifiable(), Collections.unmodifiableCollection(Arrays.asList(1,2,3))); + } + + public void testMismatchesArrayList() { + assertMismatchDescription("was able to add a value into the collection", isUnmodifiable(), new ArrayList<>()); + } + + public void testMismatchesArraysList() { + assertMismatchDescription("was able to remove a value from the collection", isUnmodifiable(), Arrays.asList(1,2,3)); + } + + public void testMismatchesHashSet() { + assertMismatchDescription("was able to add a value into the collection", isUnmodifiable(), new HashSet<>()); + } + + public void testMismatchesPartiallyUnmodifiableListAllowingAddAll() { + assertMismatchDescription("was able to perform addAll on the collection", isUnmodifiable(), new ArrayList() { + @Override + public boolean add(String s) { + throw new UnsupportedOperationException(); + } + }); + } + + public void testMismatchesPartiallyUnmodifiableListAllowingRemove() { + assertMismatchDescription("was able to remove a value from the collection", isUnmodifiable(), new ArrayList() { + @Override + public boolean add(String s) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean addAll(Collection c) { + throw new UnsupportedOperationException(); + } + }); + } + + public void testMismatchesPartiallyUnmodifiableListAllowingRemoveAll() { + assertMismatchDescription("was able to perform removeAll on the collection", isUnmodifiable(), new ArrayList() { + @Override + public boolean add(String s) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean addAll(Collection c) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean remove(Object o) { + throw new UnsupportedOperationException(); + } + }); + } + + public void testMismatchesPartiallyUnmodifiableListAllowingRetainAll() { + assertMismatchDescription("was able to perform retainAll on the collection", isUnmodifiable(), new ArrayList() { + @Override + public boolean add(String s) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean addAll(Collection c) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean remove(Object o) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean removeAll(Collection c) { + throw new UnsupportedOperationException(); + } + }); + } + + public void testMismatchesPartiallyUnmodifiableListAllowingClear() { + assertMismatchDescription("was able to clear the collection", isUnmodifiable(), new ArrayList() { + @Override + public boolean add(String s) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean addAll(Collection c) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean remove(Object o) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean removeAll(Collection c) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean retainAll(Collection c) { + throw new UnsupportedOperationException(); + } + }); + } + +} From 3929ae3b89d8f5a2a56c9ab6d9d43e7f9dfd51c6 Mon Sep 17 00:00:00 2001 From: John Patrick <142304+nhojpatrick@users.noreply.github.com> Date: Sun, 13 Feb 2022 22:04:41 +0000 Subject: [PATCH 53/54] Java 7 Clean Up Explicit type argument T can be replaced with <> --- hamcrest/src/main/java/org/hamcrest/Condition.java | 4 ++-- .../main/java/org/hamcrest/beans/HasProperty.java | 2 +- .../main/java/org/hamcrest/collection/IsArray.java | 2 +- .../collection/IsArrayContainingInAnyOrder.java | 8 ++++---- .../collection/IsArrayContainingInOrder.java | 6 +++--- .../hamcrest/collection/IsCollectionWithSize.java | 2 +- .../org/hamcrest/collection/IsEmptyCollection.java | 2 +- .../org/hamcrest/collection/IsEmptyIterable.java | 2 +- .../hamcrest/collection/IsIterableWithSize.java | 2 +- .../comparator/ComparatorMatcherBuilder.java | 14 +++++++------- .../main/java/org/hamcrest/core/DescribedAs.java | 2 +- .../src/main/java/org/hamcrest/core/IsNot.java | 2 +- .../src/main/java/org/hamcrest/core/IsNull.java | 4 ++-- .../src/main/java/org/hamcrest/core/IsSame.java | 4 ++-- .../java/org/hamcrest/internal/NullSafety.java | 2 +- .../main/java/org/hamcrest/object/HasToString.java | 4 ++-- .../java/org/hamcrest/object/IsCompatibleType.java | 2 +- .../src/main/java/org/hamcrest/xml/HasXPath.java | 2 +- .../collection/IsCollectionWithSizeTest.java | 2 +- .../hamcrest/collection/IsEmptyCollectionTest.java | 4 ++-- .../hamcrest/collection/IsEmptyIterableTest.java | 4 ++-- .../java/org/hamcrest/collection/IsInTest.java | 8 ++++---- .../collection/IsMapContainingKeyTest.java | 10 +++++----- .../collection/IsMapContainingValueTest.java | 6 +++--- .../org/hamcrest/collection/IsMapWithSizeTest.java | 4 ++-- .../hamcrest/core/IsCollectionContainingTest.java | 4 ++-- .../test/java/org/hamcrest/xml/HasXPathTest.java | 2 +- 27 files changed, 55 insertions(+), 55 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/Condition.java b/hamcrest/src/main/java/org/hamcrest/Condition.java index 449314fe..4012027a 100644 --- a/hamcrest/src/main/java/org/hamcrest/Condition.java +++ b/hamcrest/src/main/java/org/hamcrest/Condition.java @@ -11,7 +11,7 @@ */ public abstract class Condition { - public static final NotMatched NOT_MATCHED = new NotMatched(); + public static final NotMatched NOT_MATCHED = new NotMatched<>(); public interface Step { Condition apply(I value, Description mismatch); @@ -31,7 +31,7 @@ public static Condition notMatched() { } public static Condition matched(final T theValue, final Description mismatch) { - return new Matched(theValue, mismatch); + return new Matched<>(theValue, mismatch); } private static final class Matched extends Condition { diff --git a/hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java b/hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java index 07181c2a..8ddd0f88 100644 --- a/hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java +++ b/hamcrest/src/main/java/org/hamcrest/beans/HasProperty.java @@ -53,7 +53,7 @@ public void describeTo(Description description) { * @return The matcher. */ public static Matcher hasProperty(String propertyName) { - return new HasProperty(propertyName); + return new HasProperty<>(propertyName); } } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java index 0080f442..181bcbeb 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArray.java @@ -101,7 +101,7 @@ protected String descriptionEnd() { * @return The matcher. */ public static IsArray array(Matcher... elementMatchers) { - return new IsArray(elementMatchers); + return new IsArray<>(elementMatchers); } } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java index 1c2c8cc5..06d05fea 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java @@ -21,7 +21,7 @@ public class IsArrayContainingInAnyOrder extends TypeSafeMatcher { private final Collection> matchers; public IsArrayContainingInAnyOrder(Collection> matchers) { - this.iterableMatcher = new IsIterableContainingInAnyOrder(matchers); + this.iterableMatcher = new IsIterableContainingInAnyOrder<>(matchers); this.matchers = matchers; } @@ -86,7 +86,7 @@ public static Matcher arrayContainingInAnyOrder(Matcher... i * @return The matcher. */ public static Matcher arrayContainingInAnyOrder(Collection> itemMatchers) { - return new IsArrayContainingInAnyOrder(itemMatchers); + return new IsArrayContainingInAnyOrder<>(itemMatchers); } /** @@ -110,11 +110,11 @@ public static Matcher arrayContainingInAnyOrder(Collection Matcher arrayContainingInAnyOrder(E... items) { - List> matchers = new ArrayList>(); + List> matchers = new ArrayList<>(); for (E item : items) { matchers.add(equalTo(item)); } - return new IsArrayContainingInAnyOrder(matchers); + return new IsArrayContainingInAnyOrder<>(matchers); } } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java index eaf5c0d7..4bf58bd3 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java @@ -20,7 +20,7 @@ public class IsArrayContainingInOrder extends TypeSafeMatcher { private final IsIterableContainingInOrder iterableMatcher; public IsArrayContainingInOrder(List> matchers) { - this.iterableMatcher = new IsIterableContainingInOrder(matchers); + this.iterableMatcher = new IsIterableContainingInOrder<>(matchers); this.matchers = matchers; } @@ -55,7 +55,7 @@ public void describeTo(Description description) { * @return The matcher. */ public static Matcher arrayContaining(E... items) { - List> matchers = new ArrayList>(); + List> matchers = new ArrayList<>(); for (E item : items) { matchers.add(equalTo(item)); } @@ -97,7 +97,7 @@ public static Matcher arrayContaining(Matcher... itemMatcher * @return The matcher. */ public static Matcher arrayContaining(List> itemMatchers) { - return new IsArrayContainingInOrder(itemMatchers); + return new IsArrayContainingInOrder<>(itemMatchers); } } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java index 812d624c..81c5fc61 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java @@ -34,7 +34,7 @@ protected Integer featureValueOf(Collection actual) { * @return The matcher. */ public static Matcher> hasSize(Matcher sizeMatcher) { - return new IsCollectionWithSize(sizeMatcher); + return new IsCollectionWithSize<>(sizeMatcher); } /** diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java index e453744c..25e6da2c 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyCollection.java @@ -37,7 +37,7 @@ public void describeTo(Description description) { * @return The matcher. */ public static Matcher> empty() { - return new IsEmptyCollection(); + return new IsEmptyCollection<>(); } /** diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java index a0097600..d1dc0394 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsEmptyIterable.java @@ -33,7 +33,7 @@ public void describeTo(Description description) { * @return The matcher. */ public static Matcher> emptyIterable() { - return new IsEmptyIterable(); + return new IsEmptyIterable<>(); } /** diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java index 95b489ab..586dfcef 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableWithSize.java @@ -36,7 +36,7 @@ protected Integer featureValueOf(Iterable actual) { * @return The matcher. */ public static Matcher> iterableWithSize(Matcher sizeMatcher) { - return new IsIterableWithSize(sizeMatcher); + return new IsIterableWithSize<>(sizeMatcher); } /** diff --git a/hamcrest/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java b/hamcrest/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java index 520def1b..022e519c 100644 --- a/hamcrest/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java +++ b/hamcrest/src/main/java/org/hamcrest/comparator/ComparatorMatcherBuilder.java @@ -23,7 +23,7 @@ public final class ComparatorMatcherBuilder { * @return The matcher. */ public static > ComparatorMatcherBuilder usingNaturalOrdering() { - return new ComparatorMatcherBuilder(new Comparator() { + return new ComparatorMatcherBuilder<>(new Comparator() { @Override public int compare(T o1, T o2) { return o1.compareTo(o2); @@ -47,7 +47,7 @@ public int compare(T o1, T o2) { * @return The matcher. */ public static ComparatorMatcherBuilder comparedBy(Comparator comparator) { - return new ComparatorMatcherBuilder(comparator, true); + return new ComparatorMatcherBuilder<>(comparator, true); } private ComparatorMatcherBuilder(Comparator comparator, boolean includeComparatorInDescription) { @@ -128,7 +128,7 @@ private static String asText(int comparison) { * @return The matcher. */ public Matcher comparesEqualTo(T value) { - return new ComparatorMatcher(comparator, value, ComparatorMatcher.EQUAL, ComparatorMatcher.EQUAL, includeComparatorInDescription); + return new ComparatorMatcher<>(comparator, value, ComparatorMatcher.EQUAL, ComparatorMatcher.EQUAL, includeComparatorInDescription); } /** @@ -143,7 +143,7 @@ public Matcher comparesEqualTo(T value) { * @return The matcher. */ public Matcher greaterThan(T value) { - return new ComparatorMatcher(comparator, value, ComparatorMatcher.GREATER_THAN, ComparatorMatcher.GREATER_THAN, includeComparatorInDescription); + return new ComparatorMatcher<>(comparator, value, ComparatorMatcher.GREATER_THAN, ComparatorMatcher.GREATER_THAN, includeComparatorInDescription); } /** @@ -158,7 +158,7 @@ public Matcher greaterThan(T value) { * @return The matcher. */ public Matcher greaterThanOrEqualTo(T value) { - return new ComparatorMatcher(comparator, value, ComparatorMatcher.EQUAL, ComparatorMatcher.GREATER_THAN, includeComparatorInDescription); + return new ComparatorMatcher<>(comparator, value, ComparatorMatcher.EQUAL, ComparatorMatcher.GREATER_THAN, includeComparatorInDescription); } /** @@ -173,7 +173,7 @@ public Matcher greaterThanOrEqualTo(T value) { * @return The matcher. */ public Matcher lessThan(T value) { - return new ComparatorMatcher(comparator, value, ComparatorMatcher.LESS_THAN, ComparatorMatcher.LESS_THAN, includeComparatorInDescription); + return new ComparatorMatcher<>(comparator, value, ComparatorMatcher.LESS_THAN, ComparatorMatcher.LESS_THAN, includeComparatorInDescription); } /** @@ -188,7 +188,7 @@ public Matcher lessThan(T value) { * @return The matcher. */ public Matcher lessThanOrEqualTo(T value) { - return new ComparatorMatcher(comparator, value, ComparatorMatcher.LESS_THAN, ComparatorMatcher.EQUAL, includeComparatorInDescription); + return new ComparatorMatcher<>(comparator, value, ComparatorMatcher.LESS_THAN, ComparatorMatcher.EQUAL, includeComparatorInDescription); } } diff --git a/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java b/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java index 81abbca6..b4138d7f 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java +++ b/hamcrest/src/main/java/org/hamcrest/core/DescribedAs.java @@ -68,7 +68,7 @@ public void describeMismatch(Object item, Description description) { * @return The matcher. */ public static Matcher describedAs(String description, Matcher matcher, Object... values) { - return new DescribedAs(description, matcher, values); + return new DescribedAs<>(description, matcher, values); } } diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsNot.java b/hamcrest/src/main/java/org/hamcrest/core/IsNot.java index bec81777..1e5db96e 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsNot.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsNot.java @@ -40,7 +40,7 @@ public void describeTo(Description description) { * @return The matcher. */ public static Matcher not(Matcher matcher) { - return new IsNot(matcher); + return new IsNot<>(matcher); } /** diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsNull.java b/hamcrest/src/main/java/org/hamcrest/core/IsNull.java index e177e4ed..6977968b 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsNull.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsNull.java @@ -29,7 +29,7 @@ public void describeTo(Description description) { * @return The matcher. */ public static Matcher nullValue() { - return new IsNull(); + return new IsNull<>(); } /** @@ -58,7 +58,7 @@ public static Matcher notNullValue() { * @return The matcher. */ public static Matcher nullValue(Class type) { - return new IsNull(); + return new IsNull<>(); } /** diff --git a/hamcrest/src/main/java/org/hamcrest/core/IsSame.java b/hamcrest/src/main/java/org/hamcrest/core/IsSame.java index 187d1020..7bd9ef89 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/IsSame.java +++ b/hamcrest/src/main/java/org/hamcrest/core/IsSame.java @@ -38,7 +38,7 @@ public void describeTo(Description description) { * @return The matcher. */ public static Matcher sameInstance(T target) { - return new IsSame(target); + return new IsSame<>(target); } /** @@ -52,7 +52,7 @@ public static Matcher sameInstance(T target) { * @return The matcher. */ public static Matcher theInstance(T target) { - return new IsSame(target); + return new IsSame<>(target); } } diff --git a/hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java b/hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java index 4ece6a9d..d27349a4 100644 --- a/hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java +++ b/hamcrest/src/main/java/org/hamcrest/internal/NullSafety.java @@ -10,7 +10,7 @@ public class NullSafety { @SuppressWarnings("unchecked") public static List> nullSafe(Matcher[] itemMatchers) { - final List> matchers = new ArrayList>(itemMatchers.length); + final List> matchers = new ArrayList<>(itemMatchers.length); for (final Matcher itemMatcher : itemMatchers) { matchers.add((Matcher) (itemMatcher == null ? IsNull.nullValue() : itemMatcher)); } diff --git a/hamcrest/src/main/java/org/hamcrest/object/HasToString.java b/hamcrest/src/main/java/org/hamcrest/object/HasToString.java index 51942654..74261761 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/HasToString.java +++ b/hamcrest/src/main/java/org/hamcrest/object/HasToString.java @@ -29,7 +29,7 @@ protected String featureValueOf(T actual) { * @return The matcher. */ public static Matcher hasToString(Matcher toStringMatcher) { - return new HasToString(toStringMatcher); + return new HasToString<>(toStringMatcher); } /** @@ -45,7 +45,7 @@ public static Matcher hasToString(Matcher toStringMatcher * @return The matcher. */ public static Matcher hasToString(String expectedToString) { - return new HasToString(equalTo(expectedToString)); + return new HasToString<>(equalTo(expectedToString)); } } diff --git a/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java b/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java index 01f81e35..ab7d8a24 100644 --- a/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java +++ b/hamcrest/src/main/java/org/hamcrest/object/IsCompatibleType.java @@ -40,7 +40,7 @@ public void describeTo(Description description) { * @return The matcher. */ public static Matcher> typeCompatibleWith(Class baseType) { - return new IsCompatibleType(baseType); + return new IsCompatibleType<>(baseType); } } diff --git a/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java b/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java index a957fd6e..6b220f4f 100644 --- a/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java +++ b/hamcrest/src/main/java/org/hamcrest/xml/HasXPath.java @@ -24,7 +24,7 @@ public class HasXPath extends TypeSafeDiagnosingMatcher { public static final NamespaceContext NO_NAMESPACE_CONTEXT = null; - private static final IsAnything WITH_ANY_CONTENT = new IsAnything(""); + private static final IsAnything WITH_ANY_CONTENT = new IsAnything<>(""); private static final Condition.Step NODE_EXISTS = nodeExists(); private final Matcher valueMatcher; private final XPathExpression compiledXPath; diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java index 99bce034..0d6a3eed 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java @@ -71,7 +71,7 @@ public void testHasAReadableDescription() { public void testCompilesWithATypedCollection() { // To prove Issue 43 - ArrayList arrayList = new ArrayList(); + ArrayList arrayList = new ArrayList<>(); MatcherAssert.assertThat(arrayList, hasSize(0)); } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyCollectionTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyCollectionTest.java index f2d309dc..4422a2ab 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyCollectionTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyCollectionTest.java @@ -36,11 +36,11 @@ public void testCompiles() { private void needs(@SuppressWarnings("unused") Matcher> bar) { } private static Collection collectionOfValues() { - return new ArrayList(asList("one", "three")); + return new ArrayList<>(asList("one", "three")); } private static Collection emptyCollection() { - return new ArrayList(); + return new ArrayList<>(); } } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyIterableTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyIterableTest.java index 5689d906..37027c50 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyIterableTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsEmptyIterableTest.java @@ -35,11 +35,11 @@ public void testCompiles() { private void needs(@SuppressWarnings("unused") Matcher> bar) { } private static Collection collectionOfValues() { - return new ArrayList(asList("one", "three")); + return new ArrayList<>(asList("one", "three")); } private static Collection emptyCollection() { - return new ArrayList(); + return new ArrayList<>(); } } diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java index 16333564..87fccc0a 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsInTest.java @@ -13,12 +13,12 @@ public class IsInTest extends AbstractMatcherTest { @Override protected Matcher createMatcher() { - return new IsIn(elements); + return new IsIn<>(elements); } public void testReturnsTrueIfArgumentIsInCollection() { Collection collection = Arrays.asList(elements); - Matcher isIn = new IsIn(collection); + Matcher isIn = new IsIn<>(collection); assertMatches("a", isIn, "a"); assertMatches("b", isIn, "b"); @@ -27,7 +27,7 @@ public void testReturnsTrueIfArgumentIsInCollection() { } public void testReturnsTrueIfArgumentIsInArray() { - Matcher isIn = new IsIn(elements); + Matcher isIn = new IsIn<>(elements); assertMatches("a", isIn, "a"); assertMatches("b", isIn, "b"); @@ -36,7 +36,7 @@ public void testReturnsTrueIfArgumentIsInArray() { } public void testHasReadableDescription() { - Matcher isIn = new IsIn(elements); + Matcher isIn = new IsIn<>(elements); assertEquals("description", "one of {\"a\", \"b\", \"c\"}", diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java index b6c4f4bc..db25b68e 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingKeyTest.java @@ -18,14 +18,14 @@ protected Matcher createMatcher() { } public void testMatchesSingletonMapContainingKey() { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("a", 1); assertMatches("Matches single key", hasKey("a"), map); } public void testMatchesMapContainingKey() { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("a", 1); map.put("b", 2); map.put("c", 3); @@ -46,7 +46,7 @@ public void testMatchesMapContainingKey() { // } public void testMatchesMapContainingKeyWithIntegerKeys() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put(1, "A"); map.put(2, "B"); @@ -54,7 +54,7 @@ public void testMatchesMapContainingKeyWithIntegerKeys() throws Exception { } public void testMatchesMapContainingKeyWithNumberKeys() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put(1, "A"); map.put(2, "B"); @@ -73,7 +73,7 @@ public void testDoesNotMatchEmptyMap() { } public void testDoesNotMatchMapMissingKey() { - Map map = new TreeMap(); + Map map = new TreeMap<>(); map.put("a", 1); map.put("b", 2); map.put("c", 3); diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java index 523f56aa..ae657742 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingValueTest.java @@ -21,19 +21,19 @@ public void testHasReadableDescription() { } public void testDoesNotMatchEmptyMap() { - Map map = new HashMap(); + Map map = new HashMap<>(); assertMismatchDescription("map was []", hasValue(1), map); } public void testMatchesSingletonMapContainingValue() { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("a", 1); assertMatches("Singleton map", hasValue(1), map); } public void testMatchesMapContainingValue() { - Map map = new TreeMap(); + Map map = new TreeMap<>(); map.put("a", 1); map.put("b", 2); map.put("c", 3); diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java index 8739be58..bcd2761f 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java @@ -68,12 +68,12 @@ public void testHasAReadableDescription() { } public void testCompilesWithATypedMap() { - Map arrayList = new HashMap(); + Map arrayList = new HashMap<>(); MatcherAssert.assertThat(arrayList, aMapWithSize(0)); } private static Map mapWithKeys(K... keys) { - final Map result = new HashMap(); + final Map result = new HashMap<>(); for (K key : keys) { result.put(key, null); } diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java index 0b98e881..f1540198 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsCollectionContainingTest.java @@ -47,9 +47,9 @@ public void testHasAReadableDescription() { public void testCanMatchItemWhenCollectionHoldsSuperclass() // Issue 24 { - final Set s = new HashSet(); + final Set s = new HashSet<>(); s.add(2); - assertThat(s, new IsCollectionContaining(new IsEqual(2))); + assertThat(s, new IsCollectionContaining<>(new IsEqual(2))); assertThat(s, IsCollectionContaining.hasItem(2)); } diff --git a/hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java b/hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java index 3f8067b8..cc9b6316 100644 --- a/hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java +++ b/hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java @@ -48,7 +48,7 @@ public String getPrefix(String namespaceURI) { @Override public Iterator getPrefixes(String namespaceURI) { - HashSet prefixes = new HashSet(); + HashSet prefixes = new HashSet<>(); String prefix = getPrefix(namespaceURI); if (prefix != null) { prefixes.add(prefix); From b3e19ceea3b959f244ad983d659cdc63ef133e2b Mon Sep 17 00:00:00 2001 From: gokareless Date: Tue, 15 Feb 2022 11:39:28 +0200 Subject: [PATCH 54/54] - Resolved conflicts --- .../IsIterableContainingInAnyOrder.java | 11 ++++++-- .../IsIterableContainingInOrder.java | 5 ++++ .../test/java/org/hamcrest/MatchersTest.java | 28 +++++++++++++++++++ .../core/IsIterableContainingTest.java | 22 +++++++++++++++ 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 hamcrest/src/test/java/org/hamcrest/MatchersTest.java diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java index 262a1263..4c3e44df 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java @@ -131,10 +131,17 @@ public static Matcher> containsInAnyOrder(Matcher Matcher> containsInAnyOrder(T... items) { List> matchers = new ArrayList<>(); - for (T item : items) { + if (items.length == 1 && items[0].getClass().isArray()) { + @SuppressWarnings("unchecked") + T[] realItems = (T[]) items[0]; + for (T item : realItems) { matchers.add(equalTo(item)); + } + } else { + for (T item : items) { + matchers.add(equalTo(item)); + } } - return new IsIterableContainingInAnyOrder<>(matchers); } diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java index 00b89ea7..dd75cccf 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java @@ -98,6 +98,11 @@ private void describeMismatch(Matcher matcher, F item) { */ @SafeVarargs public static Matcher> contains(E... items) { + if (items.length == 1 && items[0].getClass().isArray()) { + @SuppressWarnings("unchecked") + E[] realItems = (E[]) items[0]; + return contains(asEqualMatchers(realItems)); + } return contains(asEqualMatchers(items)); } diff --git a/hamcrest/src/test/java/org/hamcrest/MatchersTest.java b/hamcrest/src/test/java/org/hamcrest/MatchersTest.java new file mode 100644 index 00000000..e2395e6f --- /dev/null +++ b/hamcrest/src/test/java/org/hamcrest/MatchersTest.java @@ -0,0 +1,28 @@ +package org.hamcrest; + +import java.util.Arrays; +import org.hamcrest.core.AnyOf; +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; + +public class MatchersTest { + + @Test + public void matchersContainsInAnyOrderCastTest() { + String[] truth = new String[] { "1", "2" }; + assertThat("doesn't contain elements", Arrays.asList("1", "2"), containsInAnyOrder(truth)); + Object otherTruth = truth; + assertThat("doesn't contain elements", Arrays.asList("1", "2"), containsInAnyOrder(otherTruth)); + } + + @Test + public void matchersContainsCastTest() { + String[] truth = new String[] { "1", "2" }; + assertThat("doesn't contain elements", Arrays.asList("1", "2"), contains(truth)); + Object otherTruth = truth; + assertThat("doesn't contain elements", Arrays.asList("1", "2"), contains(otherTruth)); + } +} diff --git a/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java b/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java index b20942be..3a0e6436 100644 --- a/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java +++ b/hamcrest/src/test/java/org/hamcrest/core/IsIterableContainingTest.java @@ -6,6 +6,7 @@ import org.junit.Test; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashSet; import java.util.Set; @@ -13,6 +14,8 @@ import static org.hamcrest.AbstractMatcherTest.*; import static org.hamcrest.core.IsIterableContaining.hasItem; import static org.hamcrest.core.IsIterableContaining.hasItems; +import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder; +import static org.hamcrest.collection.IsIterableContainingInOrder.contains; import static org.hamcrest.core.IsEqual.equalTo; public final class IsIterableContainingTest { @@ -86,6 +89,25 @@ public final class IsIterableContainingTest { matcher, asList(1, 2, 3)); } + @Test public void + isIterableContainingAnyOrderCast() { + String[] array = new String[]{"1", "2"}; + Object object = array; + Iterable real = Arrays.asList("1", "2"); + final Matcher> matcher = containsInAnyOrder(object); + assertTrue("does not match the same object", matcher.matches(real)); + } + + @Test + public void + isIterableContainingCast() { + String[] array = new String[]{"1", "2"}; + Object object = array; + Iterable real = Arrays.asList("1", "2"); + final Matcher> matcher = contains(object); + assertTrue("does not match the same object", matcher.matches(real)); + } + private static Matcher mismatchable(final String string) { return new TypeSafeDiagnosingMatcher() { @Override