我是Spring的新手,对JUnit和Mockito有一些经验。
我有一个需要进行单元测试的方法:
public static String getUserNames(final String userName {
List<String> results = new LinkedList<String>();
results = service.getJdbcTemplate().query("SELECT USERNAME FROM USERNAMES WHERE NAME = ?", new RowMapper<String>() {
@Override
public String mapRow(ResultSet rs, int rowNum) throws SQLException {
return new String(rs.getString("USERNAME");
}
}
return results.get(0);
},userName)
请问有人可以提供使用JUnit和Mockito实现这个功能的建议吗?
非常感谢您的帮助!