Java hamcrest匹配器给出Matchers.contains方法的编译错误

时间:2018-07-23 21:48:03

标签: java mockito hamcrest

这是示例代码

AssertionError: <HttpResponse status_code=200, "text/html; charset=utf-8">
             != <HttpResponse status_code=200, "text/html; charset=utf-8">

测试代码:

class MyObj {
    public int funcA(List<MyItem> myItemList) {
        ...
    }
}

当我尝试编译测试代码时,它会出现以下编译错误:

MyObj mockedObj = mock(MyObj.class);

when(mockedObj.funcA(argThat(Matchers.<MyItem>contains(mockedMyItem)).thenReturn(1);

有什么想法吗?

0 个答案:

没有答案