### Question:
Customer { public Long getId() { return id; } Customer();  Customer(String firstName, String lastName, String email); Long getId(); String getFirstName(); void setFirstName(String firstName); String getLastName(); void setLastName(String lastName); String getEmail(); void setEmail(String email); Address getAddress(); void setAddress(Address address);  }### Answer:
@Test public void shouldPersistACustomer() throws Exception { Customer customer = new Customer("Anthony", "Balla", "aballa@mail.com"); tx.begin(); em.persist(customer); tx.commit(); assertNotNull(customer.getId()); }
@Test public void shouldPersistAnAddress() throws Exception { Address address = new Address("Ritherdon Rd", "London", "8QE", "UK"); tx.begin(); em.persist(address); tx.commit(); assertNotNull(address.getId()); }
@Test public void shouldPersistACustomerTwice() throws Exception { Customer customer = new Customer("Anthony", "Balla", "aballa@mail.com"); tx.begin(); em.persist(customer); tx.commit(); assertNotNull(customer.getId()); em.clear(); assertThrows(RollbackException.class, () -> { tx.begin(); em.persist(customer); tx.commit(); }); }