New to this, only my second day, but I'm having a hard time getting complete coverage for this method.... I think I just don't under stand lambdas correctly? or maybe I just dont understand all of Mockito yet? maybe both...
below is source code under unit test:
List<String> domains = jdbcTemplate.query(
query,
(rs, rownum) -> rs.getString(1)
);
This is what I have currently that compiles for some coverage:
@Test
public void test_Repository_getAIPDomains() throws DataAccessException {
when(jdbcTemplate.query(anyString(), Mockito.any(RowMapper.class))).thenReturn(testStringList);
List<String> testList = Repository.getAIPDomains();
Assertions.assertEquals("junit", testList.get(0));
}
this doesn't provide coverage for:
(rs, rownum) -> rs.getString(1)
I've tried a lot of different things to attempt coverage, but it gets a little messy with resultSetExtractor and other rollbackcallhandler. Any help is greatly appreciated, or even some links to some resources.