@Test
public void testHandleRollback()
{
// Extended
pc.setPersistenceContextType(PersistenceContextType.EXTENDED);
Node storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.PERSIST);
state.handleRollback(storeNode);
Assert.assertEquals(ManagedState.class, storeNode.getCurrentNodeState().getClass());
for (Node childNode : storeNode.getChildren().values())
{
Assert.assertEquals(BillingCounter.class, childNode.getDataClass());
Assert.assertEquals(RemovedState.class, childNode.getCurrentNodeState().getClass());
}
// Transactional
pc.setPersistenceContextType(PersistenceContextType.TRANSACTION);
storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.PERSIST);
state.handleRollback(storeNode);
Assert.assertEquals(DetachedState.class, storeNode.getCurrentNodeState().getClass());
for (Node childNode : storeNode.getChildren().values())
{
Assert.assertEquals(BillingCounter.class, childNode.getDataClass());
Assert.assertEquals(RemovedState.class, childNode.getCurrentNodeState().getClass());
}
}