Skip to content

Commit 551236d

Browse files
author
p3muet@gmail.com
committed
fixing broken build by completing the merge
1 parent f26c0e8 commit 551236d

7 files changed

Lines changed: 16 additions & 18 deletions

File tree

‎hamcrest-library/src/main/java/org/hamcrest/collection/CollectionMatcher.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
import java.util.Collection;
66

7-
public abstract class CollectionMatcher<T> extends BaseMatcher<Collection<T>> {
7+
public abstract class CollectionMatcher<C extends Collection<?>> extends BaseMatcher<C> {
88
@SuppressWarnings("unchecked")
99
public boolean matches(Object item) {
1010
if (!(item instanceof Collection)) {
1111
return false;
1212
}
13-
return matchesSafely((Collection<T>)item);
13+
return matchesSafely((C)item);
1414
}
1515

16-
protected abstract boolean matchesSafely(Collection<T> collection);
16+
protected abstract boolean matchesSafely(C collection);
1717
}

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsArray.java‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44

55
import org.hamcrest.Description;
66
import org.hamcrest.Matcher;
7-
import org.hamcrest.TypeSafeMatcher;
87

98
/**
109
* Matcher for array whose elements satisfy a sequence of matchers.
1110
* The array size must equal the number of element matchers.
1211
*/
13-
public class IsArray<T> extends TypeSafeMatcher<T[]> {
12+
public class IsArray<T> extends ArrayMatcher<T> {
1413
private final Matcher<T>[] elementMatchers;
1514

15+
@SuppressWarnings("unchecked")
1616
public IsArray(Matcher<T>[] elementMatchers) {
17-
this.elementMatchers = elementMatchers.clone();
17+
this.elementMatchers = new Matcher[elementMatchers.length];
18+
System.arraycopy(elementMatchers, 0, this.elementMatchers, 0, elementMatchers.length);
1819
}
1920

2021
@Override

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22

33
import static org.hamcrest.core.IsEqual.equalTo;
44

5-
import java.util.Collection;
6-
75
import org.hamcrest.Description;
86
import org.hamcrest.Factory;
97
import org.hamcrest.Matcher;
10-
import org.hamcrest.TypeSafeMatcher;
8+
9+
import java.util.Collection;
1110

1211
/**
1312
* Matches if collection size satisfies a nested matcher.
1413
*/
15-
public class IsCollectionWithSize<E> extends TypeSafeMatcher<Collection<? extends E>> {
14+
public class IsCollectionWithSize<E> extends CollectionMatcher<Collection<? extends E>> {
1615
private final Matcher<? super Integer> sizeMatcher;
1716

1817
public IsCollectionWithSize(Matcher<? super Integer> sizeMatcher) {
@@ -37,7 +36,6 @@ public static <E> Matcher<? super Collection<? extends E>> hasSize(Matcher<? sup
3736
return new IsCollectionWithSize<E>(size);
3837
}
3938

40-
4139
/**
4240
* This is a shortcut to the frequently used hasSize(equalTo(x)).
4341
*

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyCollection.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package org.hamcrest.collection;
22

3-
import java.util.Collection;
4-
53
import org.hamcrest.Description;
64
import org.hamcrest.Factory;
75
import org.hamcrest.Matcher;
86

7+
import java.util.Collection;
8+
99
/**
1010
* Tests if collection is empty.
1111
*/
12-
public class IsEmptyCollection<E> extends CollectionMatcher<E> {
12+
public class IsEmptyCollection<E> extends CollectionMatcher<Collection<E>> {
1313

1414
@Override
1515
public boolean matchesSafely(Collection<E> item) {

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsMapContaining.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
import org.hamcrest.Description;
44
import org.hamcrest.Factory;
55
import org.hamcrest.Matcher;
6-
import org.hamcrest.TypeSafeMatcher;
76

87
import static org.hamcrest.core.IsEqual.equalTo;
98

109
import java.util.Map;
1110
import java.util.Map.Entry;
1211

13-
public class IsMapContaining<K,V> extends TypeSafeMatcher<Map<? extends K, ? extends V>> {
12+
public class IsMapContaining<K, V> extends MapTypeSafeMatcher<Map<? extends K, ? extends V>> {
1413
private final Matcher<? super K> keyMatcher;
1514
private final Matcher<? super V> valueMatcher;
1615

‎hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ protected Matcher<?> createMatcher() {
1414
}
1515

1616
public void testHasAReadableDescription() {
17-
assertDescription("[<<1>>, <<2>>] in any order",
17+
assertDescription("[<1>, <2>] in any order",
1818
arrayContainingInAnyOrder(equalTo(1), equalTo(2)));
1919
}
2020
}

‎hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ protected Matcher<?> createMatcher() {
1414
}
1515

1616
public void testHasAReadableDescription() {
17-
assertDescription("[<<1>>, <<2>>]",
17+
assertDescription("[<1>, <2>]",
1818
arrayContaining(equalTo(1), equalTo(2)));
1919
}
2020
}

0 commit comments

Comments
 (0)