This is an Issue which I am having while Upgrading my REST project from 1.7 to 1.8
The test cases seem to show compilation errors after the upgrade
This is the Old code which used to work
when(mockBuilder.post(any(Class.class), anyObject()))
.thenReturn(mockResponse);
where the post method in my builder is
@Override
public <T> T post(Class<T> c, Object requestEntity) {
return response();
}
Now after the Upgrade my mock test case shows a compilation failure I have java 1.8 and mockito 1.9
Seems like the compiler is unable to find a method with matching arguments
I have tried using other mockito mathcers like any(),isA() and Eq() None of them seems to works,Any suggestions are appreciated
Try just...
when(mockBuilder.post(any(), anyObject()))
.thenReturn(mockResponse);
There have been some changes to Java 8 generics, for example Java 8: Generic type inference improvements
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.