Seems like the problem is that within getSomeString()
the jdbcTemplate
field is null
. This is because while you set this field on the daoImpl
field in the setup()
method, you are not using the daoImpl
field....you are shadowing the field with a local variable here:
DAOImpl daoImpl = new DAOImpl();
This local variable doesn't have the jdbcTemplate
field set to the mock object. Remove that line and I'm thinking it will work.