The simple test case below is failing with an exception.
org.mockito.exceptions.misusing.InvalidUseOfMatchersException:
Invalid use of argument matchers! 3 matchers expected, 2 recorded:
I am not sure what is wrong
@Test
public void testGetStringTest(){
final long testId = 1;
String dlrBAC = null;
NamedParameterJdbcTemplate jdbcTemplate = mock(NamedParameterJdbcTemplate.class);
when(this.dao.getNamedParameterJdbcTemplate()).thenReturn(jdbcTemplate);
when(jdbcTemplate.queryForObject(anyString(), any(SqlParameterSource.class), String.class
)).thenReturn("Test");
dlrBAC = dao.getStringTest(testId);
assertNotNull(dlrBAC);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…