コード例 #1
0
 public void testDeleteWithRequiredRowsAffected() throws SQLException {
   TestSqlMapClientTemplate template = new TestSqlMapClientTemplate();
   template.executor.delete("myStatement", "myParameter");
   template.executorControl.setReturnValue(10, 1);
   template.executorControl.replay();
   template.delete("myStatement", "myParameter", 10);
   template.executorControl.verify();
 }
コード例 #2
0
 public void testDeleteWithParameter() throws SQLException {
   TestSqlMapClientTemplate template = new TestSqlMapClientTemplate();
   template.executor.delete("myStatement", "myParameter");
   template.executorControl.setReturnValue(10, 1);
   template.executorControl.replay();
   assertEquals(10, template.delete("myStatement", "myParameter"));
   template.executorControl.verify();
 }
コード例 #3
0
 public void testDeleteWithRequiredRowsAffectedAndInvalidRowCount() throws SQLException {
   TestSqlMapClientTemplate template = new TestSqlMapClientTemplate();
   template.executor.delete("myStatement", "myParameter");
   template.executorControl.setReturnValue(20, 1);
   template.executorControl.replay();
   try {
     template.delete("myStatement", "myParameter", 10);
     fail("Should have thrown JdbcUpdateAffectedIncorrectNumberOfRowsException");
   } catch (JdbcUpdateAffectedIncorrectNumberOfRowsException ex) {
     // expected
     assertEquals(10, ex.getExpectedRowsAffected());
     assertEquals(20, ex.getActualRowsAffected());
   }
   template.executorControl.verify();
 }