private Customer getNewCustomerWithUniqueName() { Customer c1 = getCustomerComponent().createNew(); c1.setName("A" + System.currentTimeMillis()); c1.setPhoneNumber("808-555-1212"); getCustomerComponent().persist(c1); return c1; }
@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()); }