CustomerDAO { public void delete(final Customer customer) throws SQLException { if (LOG.isTraceEnabled()) { LOG.trace("CustomerDAO.delete(customer=" + customer + ")"); } final Connection connection = getConnection(); final PreparedStatement statement = connection.prepareStatement("DELETE FROM customer WHERE id = '" + customer.getId() + "';"); statement.executeUpdate(); connection.close(); } CustomerDAO(final String dataSourceJndi); int getNextId(); Customer get(final int id); List<Customer> getAll(); void insert(final Customer customer); void update(final Customer customer); void delete(final Customer customer); void clear();  }
@Test public void testDelete() throws SQLException, DuplicateException { final Customer customer = new Customer(1, "First customer name"); customerDAO.insert(customer); customerDAO.delete(customer); Assert.assertEquals(null, customerDAO.get(1)); }