Hamcrest Matchers any() is not working in Java 8.
when(simpleJdbcCall.execute(Matchers.any(SqlParameterSource.class))).thenReturn(outputParameters);
any() is only working with org.mockito.Matchers which is deprecated.
Is there another way to use this method in Java 8?
any(Class)
, not Hamcrest'swhen(simpleJdbcCall.execute(Mockito.any(SqlParameterSource.class))).thenReturn(outputParameters);
You're trying to make Mockito work with Hamcrest's method. It won't work. So change your call from Matchers.any(SqlParameterSource.class)
to Mockito.any(SqlParameterSource.class)
.