hasItems , , . , Hamcrest Iterable s. ( , , Java-, ).
( , generics, Map<String, String>, Map).
...
, / @SuppressWarnings("unchecked") :
assertThat(actualMap.entrySet(), (Matcher)hasItems(expectedMap.entrySet().toArray()));
: hasItems, Set Iterable, . Set.toArray() Object[], assertThat actualMap.entrySet(), , .
, , - Set - Iterable<Object> ( ), :
assertThat(new HashSet<Object>(actualMap.entrySet()), hasItems(expectedMap.entrySet().toArray()));
, , , , :
for (Entry<String, String> entry : expectedMap.entrySet()) {
assertThat(actualMap, hasEntry(entry.getKey(), entry.getValue()));
}
... Matcher - , SO.