DalQueryHandler { public void handleUpdate(DalQuery<Integer> query) { try { Integer result = query.doQuery(); if(result == null || result == 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 handleUpdate() throws Exception { handler.handleUpdate(new DalQuery<Integer>() { @Override public Integer doQuery() throws DalException { return 0; } }); }
@Test(expected = DalUpdateException.class) public void handleUpdate2() throws Exception { handler.handleUpdate(new DalQuery<Integer>() { @Override public Integer doQuery() throws DalException { throw new DalException("Resource Not Found"); } }); }