2016-09-29 67 views
1

我試圖去用EasyMock的交手嘲笑澤西客戶端API調用的一些... 我試圖嘲弄以下調用生成器API的調用:EasyMock的和通用PARAMS

<T> T post(Entity<?> entity, Class<T> responseType); 

執行以下操作:

EasyMock.expect(mockInvocationBuilder.post(Entity.json(request), Response.class)).andReturn(mockResponse).anyTimes(); 

這是給我下面的錯誤:

java.lang.AssertionError: 
    Unexpected method call Builder.post(Entity{[email protected], variant=Variant[mediaType=application/json, language=null, encoding=null], annotations=[]}, class javax.ws.rs.core.Response): 

誰能s ^呃我在這裏做錯了什麼,我怎麼能正確地嘲笑這個?

+1

默認情況下,EasyMock使用'equals'匹配參數。在Entity上定義了一個合適的equals方法嗎? – Henri

回答