I am new to Jmockit and I am trying to make fun of jdbcTemplate.udpate() using the following check,
new Expectations() {{ someRef.flushUpdates(); }}; new Verifications() {{ String query; jdbcTemplate.update(query = withCapture(), withInstanceOf(Date.class)); times = 1; }};
flushUpdate has an update request,
public void flushUpdates(){ Date now = new Date(); String query = "Update table_name set last_updated = ? "; jdbcTemplate.update(query,now); }
The test should check if the update request is run twice.
But I get the following error.
mockit.internal.MissingInvocation: Missing 1 invocations to: org.springframework.jdbc.core.JdbcTemplate#update(String, Object[]) with arguments: any String, an instance of java.util.Date on mock instance: org.springframework.jdbc.core.JdbcTemplate@2d000e80
Does anyone have any ideas?
source share