I have two methods in my Java class as below
Method 1:
public ResponseEntity<T> callMethod(String param1,Map<String, String> param2, Object param3,HttpMethod param4,Class<T> param5)
Method 2
public ResponseEntity<T> callMethod(Map<String, String> param1, Object param2,
HttpMethod param3, Map<String, ?> param4,
final Class<T> param5) {
I have written a unit test case where when i try to call the method as below
callMethod(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(),
eq(ServiceResponse.class))).thenReturn(responseEntity)
it fails with the below error
reference to callMethod is ambiguous
both method callMethod
(java.util.Map<java.lang.String,java.lang.String>,B,org.springframework.http.HttpMethod,java.util.Map<java.lang.String,?>,java.lang.Class)
and method
callMethod(java.lang.String,java.util.Map<java.lang.String,java.lang.String>,B,org.springframework.http.HttpMethod,java.lang.Class)
match
How can this be resolved. There are many unit test cases and i want to fix the class than the unit test cases. Is there a way?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…