|
7 | 7 | import java.util.Map; |
8 | 8 | import java.util.Map.Entry; |
9 | 9 |
|
10 | | -import static org.hamcrest.core.IsAnything.anything; |
11 | | -import static org.hamcrest.core.IsEqual.equalTo; |
12 | | - |
13 | 10 | public class IsMapContaining<K,V> extends TypeSafeMatcher<Map<? extends K, ? extends V>> { |
14 | 11 | private final Matcher<? super K> keyMatcher; |
15 | 12 | private final Matcher<? super V> valueMatcher; |
@@ -43,55 +40,4 @@ public void describeTo(Description description) { |
43 | 40 | .appendText("]"); |
44 | 41 | } |
45 | 42 |
|
46 | | - /** |
47 | | - * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains |
48 | | - * at least one key that satisfies the specified matcher. |
49 | | - * For example: |
50 | | - * <pre>assertThat(myMap, hasKey(equalTo("bar")))</pre> |
51 | | - * |
52 | | - * @param keyMatcher |
53 | | - * the matcher that must be satisfied by at least one key |
54 | | - */ |
55 | | - public static <K> Matcher<Map<? extends K, ?>> hasKey(Matcher<? super K> keyMatcher) { |
56 | | - return new IsMapContaining<>(keyMatcher, anything()); |
57 | | - } |
58 | | - |
59 | | - /** |
60 | | - * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains |
61 | | - * at least one key that is equal to the specified key. |
62 | | - * For example: |
63 | | - * <pre>assertThat(myMap, hasKey("bar"))</pre> |
64 | | - * |
65 | | - * @param key |
66 | | - * the key that satisfying maps must contain |
67 | | - */ |
68 | | - public static <K> Matcher<Map<? extends K, ?>> hasKey(K key) { |
69 | | - return new IsMapContaining<>(equalTo(key), anything()); |
70 | | - } |
71 | | - |
72 | | - /** |
73 | | - * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains |
74 | | - * at least one value that satisfies the specified valueMatcher. |
75 | | - * For example: |
76 | | - * <pre>assertThat(myMap, hasValue(equalTo("foo")))</pre> |
77 | | - * |
78 | | - * @param valueMatcher |
79 | | - * the matcher that must be satisfied by at least one value |
80 | | - */ |
81 | | - public static <V> Matcher<Map<?, ? extends V>> hasValue(Matcher<? super V> valueMatcher) { |
82 | | - return new IsMapContaining<>(anything(), valueMatcher); |
83 | | - } |
84 | | - |
85 | | - /** |
86 | | - * Creates a matcher for {@link java.util.Map}s matching when the examined {@link java.util.Map} contains |
87 | | - * at least one value that is equal to the specified value. |
88 | | - * For example: |
89 | | - * <pre>assertThat(myMap, hasValue("foo"))</pre> |
90 | | - * |
91 | | - * @param value |
92 | | - * the value that satisfying maps must contain |
93 | | - */ |
94 | | - public static <V> Matcher<Map<?, ? extends V>> hasValue(V value) { |
95 | | - return new IsMapContaining<>(anything(), equalTo(value)); |
96 | | - } |
97 | 43 | } |
0 commit comments