嗨,我有一个方法并将结果作为地图返回。
public @ResponseBody Map<String, Object>getDetails(HttpServletRequest request, CustomRequest request){
Map<String, Object> result = (Map<String, Object>) restAgent.post(getRequestMapping(request), customRequest, Map.class);
return result;
}
and i have return junit for this method using mockito framework.
public void testGetDetails(){
when(restAgent.post(eq(Mockito.anyString(), eq(customRequest), Map.class).thenReturn(new HashMap());
getDetails(request, customRequest)// after executing this getting result is null
}
我得到空结果。
如何模拟getDetails方法