DalQueryHandler { public void handleBatchUpdate(DalQuery<int[]> query) { try { int[] result = query.doQuery(); if(result == null) { throw new DalUpdateException("No rows updated"); } int changeSum = 0; for(int changedRows: result) { changeSum += changedRows; } if(changeSum == 0) { throw new DalUpdateException("No rows updated"); } } catch (Exception e) { throw new DalUpdateException("Update failed." + e.getMessage(), e); } }  T handleQuery(DalQuery<T> query); void handleUpdate(DalQuery<Integer> query); void handleBatchUpdate(DalQuery<int[]> query); void handleDelete(DalQuery<Integer> query, boolean failAsSuccess); void handleBatchDelete(DalQuery<int[]> query, boolean failAsSuccess); void handleInsert(DalQuery<Integer> query); int[] handleBatchInsert(DalQuery<int[]> query);  }
@Test(expected = DalUpdateException.class) public void handleUpdateBatch() throws Exception { handler.handleBatchUpdate(new DalQuery<int[]>() { @Override public int[] doQuery() throws DalException { return new int[0]; } }); }