mercredi 7 octobre 2020

Hemcrest issue for List of Map assertion

Hemcrest issue for List of Map assertion.I have two List of Map. Can any one help me how to use Hemcrest for List of Map.

List<Map<String, String>> tmpMapList;
List<Map<String, String>> expected;

List<Matcher<? super List<Map<String, String>>>> expected = (List<Matcher<? super List<Map<String, String>>>>) Arrays.<Matcher<? super String>>asList((Matcher<? super String>) customEventData);
assertThat(tmpMapList, hasItem(Matchers.allOf(expected)));

java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class org.hamcrest.Matcher (java.util.ArrayList is in module java.base of loader 'bootstrap'; org.hamcrest.Matcher is in unnamed module of loader 'app')

Aucun commentaire:

Enregistrer un commentaire