@Test
public void testCrud() throws Exception {
databaseTester.onTearDown(); // crear db before tests
// CREATE
Assert.assertEquals(0, customerService.count());
Customer customer = new Customer();
customer.setName("Name");
customer.setEmail("a@a.com");
customer.setAddress("address");
customer.setPhone("111333444");
customerService.add(customer);
Assert.assertEquals(1, customerService.count());
// READ
Customer readcustomer = customerService.list().get(0);
Assert.assertEquals(readcustomer.getName(), "Name");
Assert.assertEquals(readcustomer.getEmail(), "a@a.com");
Assert.assertEquals(readcustomer.getAddress(), "address");
Assert.assertEquals(readcustomer.getPhone(), "111333444");
// UPDATE
readcustomer.setName("updatedName");
customerService.update(readcustomer);
Customer updatedCustomer = customerService.list().get(0);
Assert.assertEquals(updatedCustomer.getName(), "updatedName");
// DELETE
customerService.delete(updatedCustomer.getId());
Assert.assertEquals(0, customerService.count());
}