simpleJDBCCall.returningResultSet("test", new RowMapper<SomeObject> {
@Override
public SomeObject mapRow(Resultset r, int i) throws sqlexception {
//-----some code----
return someObject;
}
}
I want to execute the lines written inside the MapRow method using mockito
Mockito is used to stub methods, not really to execute methods. But it's still possible: you can stub your method with a dynamic
Answerto call the method of the passed instance of the anonymous class.Calling now
returningResultSeton your mock instance will immediately invoke themapRowmethod on your second argument, passing any values that you specify.Note however what the official docs say about stubbing this way: