Customer { public void setArchived(boolean archived) { this.archived = archived; } Customer();  Customer(String name); Long getId(); String getName(); void setName(String name); boolean isArchived(); void setArchived(boolean archived); final static String FIND_ALL_CUSTOMERS; }
@Test public void archivedCustomerDeleted() { Customer customer = new Customer("Bob"); em.persist(customer); customer.setArchived(true); em.remove(customer); em.flush(); assertTrue(em.createNamedQuery(Customer.FIND_ALL_CUSTOMERS) .getResultList().isEmpty()); }