The following is a simple example of an error test.
org.mockito.exceptions.misusing.InvalidUseOfMatchersException: Invalid use of argument matchers! 3 matchers expected, 2 recorded:
I'm 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); }
Anwar source share