使用jsonPath检查hashSet值

时间:2018-06-17 19:26:41

标签: jsonpath hamcrest mockmvc

在下面的代码中

.andExpect(jsonPath("$.itemsInHashSet", contains("Item1")));

我无法比较这两个值并得到以下错误

java.lang.AssertionError: JSON path "$.itemsInHashSet"
Expected: iterable containing ["Item1"]
     but: item 0: was <{name=Item1}>

itemsInHaset实现HasSet中的api。我对jsonpath在这种情况下<{name=Item1}>的输出感到困惑,collection的{​​{1}}方法都不适用于我的情况?

0 个答案:

没有答案