@Test public void testSaveOrUpdate() throws Exception { new AddressTestDataBuilder(databaseRule.getEntityManager()).buildAndSave(); List<Address> loadAllObjects = databaseRule.getTransactionHelper().loadAllObjects(Address.class); assertEquals(1, loadAllObjects.size()); }
@Test(expected = RuntimeException.class) public void testBuildAndSave_Unsuccessful() throws Exception { new AbstractTestdataBuilder<Person>(databaseRule.getEntityManager()) { @Override public Person build() { return null; } }.buildAndSave(); }
@Test public void testHasEntityManager() throws Exception { assertFalse(new AddressTestDataBuilder().hasEntityManager()); assertTrue(new AddressTestDataBuilder(databaseRule.getEntityManager()).hasEntityManager()); }