*/
@Test
public void testHandleMerge() throws IllegalArgumentException, InstantiationException, IllegalAccessException,
InvocationTargetException, SecurityException, NoSuchMethodException
{
Node storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.MERGE);
EntityManagerFactory emf = Persistence.createEntityManagerFactory("kunderatest");
Constructor constructor = PersistenceDelegator.class.getDeclaredConstructor(KunderaMetadata.class,
PersistenceCache.class);
constructor.setAccessible(true);
PersistenceDelegator pd = (PersistenceDelegator) constructor.newInstance(
((EntityManagerFactoryImpl) emf).getKunderaMetadataInstance(), new PersistenceCache());
storeNode.setPersistenceDelegator(pd);
state.handleMerge(storeNode);
Assert.assertEquals(ManagedState.class, storeNode.getCurrentNodeState().getClass());
Assert.assertTrue(storeNode.isUpdate());
Assert.assertNotNull(storeNode.getPersistenceCache().getMainCache()
.getNodeFromCache(storeNode.getNodeId(), null));
// for (Node childNode : storeNode.getChildren().values())
// {
// Assert.assertEquals(BillingCounter.class, childNode.getDataClass());
// Assert.assertEquals(ManagedState.class,