CustomerDAO { public List<Customer> getAll() throws SQLException { if (LOG.isTraceEnabled()) { LOG.trace("CustomerDAO.getAll()"); } final Connection connection = getConnection(); final PreparedStatement statement = connection.prepareStatement("SELECT * FROM customer;"); final ResultSet resultSet = statement.executeQuery(); final List<Customer> customers = resultSetToCustomers(resultSet); connection.close(); return customers; } 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 testGetAllFromEmptyDatabase() throws SQLException { Assert.assertEquals(new ArrayList<Customer>(), customerDAO.getAll()); }