KerberosDescriptorDAO { @Transactional public void create(KerberosDescriptorEntity kerberosDescriptorEntity) { entityManagerProvider.get().persist(kerberosDescriptorEntity); }  @RequiresSession KerberosDescriptorEntity findByName(String kerberosDescriptorName); @RequiresSession List<KerberosDescriptorEntity> findAll(); @Transactional void create(KerberosDescriptorEntity kerberosDescriptorEntity); @Transactional void refresh(KerberosDescriptorEntity kerberosDescriptorEntity); @Transactional KerberosDescriptorEntity merge(KerberosDescriptorEntity kerberosDescriptorEntity); @Transactional void remove(KerberosDescriptorEntity kerberosDescriptorEntity); @Transactional void removeByName(String name);  }
@Test public void testPersistNewKerberosDescriptorEntity() { KerberosDescriptorEntity kerberosDescriptorEntity = new KerberosDescriptorEntity(); kerberosDescriptorEntity.setName(TEST_KERBEROS_DESCRIPTOR_ENTITY_NAME); Capture<KerberosDescriptorEntity> capturedArgument = EasyMock.newCapture(); entityManager.persist(capture(capturedArgument)); replay(entityManager); kerberosDescriptorDAO.create(kerberosDescriptorEntity); Assert.assertNotNull(capturedArgument); Assert.assertEquals("The persisted object is not the expected one", kerberosDescriptorEntity, capturedArgument.getValue()); }