D
D
Dik_Nik2019-06-11 14:06:50
Java
Dik_Nik, 2019-06-11 14:06:50

How to mock JdbcTemplate.query?

There is the following method:

jdbcTemplate.query("SELECT * FROM " + tableInfo.getTableName(), (rs, rowNum) -> {...}

I write unit tests. I want to mock this method. I write the following:
doReturn(Collections.emptyList()).when(jdbcTemplate).query(anyString(), any(RowMapper.class));

But nothing works.
Please help me write a stub for this method c:

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question