@Test public void testDeleteCustomer() { Customer c1 = getNewCustomerWithUniqueName(); Customer c1FromDb = getCustomerComponent().getById(c1.getId()); getCustomerComponent().delete(c1FromDb); Customer c1FromDbAgain = getCustomerComponent().getById(c1.getId()); assertNull(c1FromDbAgain); }
@Test public void testCustomerUpdateAndGet() { Customer c1 = getNewCustomerWithUniqueName(); Customer c1FromDb = getCustomerComponent().getById(c1.getId()); String NEW_PHONE = "415-555-1212"; c1FromDb.setPhoneNumber(NEW_PHONE); getCustomerComponent().persist(c1FromDb); Customer c1FromDbAgain = getCustomerComponent().getById(c1.getId()); assertEquals(NEW_PHONE, c1FromDbAgain.getPhoneNumber()); }
@Test public void testCustomerInsertAndGet() { Customer c1 = getNewCustomerWithUniqueName(); Customer c2 = getNewCustomerWithUniqueName(); assertEquals(c1.getId() + 1, c2.getId()); Customer c1FromDb = getCustomerComponent().getById(c1.getId()); assertEquals(c1.getName(), c1FromDb.getName()); }