Program: 176506
Project: 176506
Buggy source:
/** 
 * Test method for   {@link com.impetus.kundera.lifecycle.states.NodeState#recursivelyPerformOperation(com.impetus.kundera.lifecycle.NodeStateContext,com.impetus.kundera.lifecycle.states.NodeState.OPERATION)}.
 */
@Test public void testRecursivelyPerformOperation(){
  Node storeNode=StoreBuilder.buildStoreNode(pc);
  NodeState state=new TransientState();
  state.recursivelyPerformOperation(storeNode,OPERATION.PERSIST);
  Assert.assertEquals(TransientState.class,storeNode.getCurrentNodeState().getClass());
  for (  Node childNode : storeNode.getChildren().values()) {
    Assert.assertEquals(BillingCounter.class,childNode.getDataClass());
    Assert.assertEquals(ManagedState.class,childNode.getCurrentNodeState().getClass());
  }
}

Fixed version (ground truth):
/** 
 * Test method for   {@link com.impetus.kundera.lifecycle.states.NodeState#recursivelyPerformOperation(com.impetus.kundera.lifecycle.NodeStateContext,com.impetus.kundera.lifecycle.states.NodeState.OPERATION)}.
 */
@Test public void testRecursivelyPerformOperation(){
  NodeState state=new TransientState();
  Node storeNode=StoreBuilder.buildStoreNode(pc,state,CascadeType.PERSIST);
  state.recursivelyPerformOperation(storeNode,OPERATION.PERSIST);
  Assert.assertEquals(TransientState.class,storeNode.getCurrentNodeState().getClass());
  for (  Node childNode : storeNode.getChildren().values()) {
    Assert.assertEquals(BillingCounter.class,childNode.getDataClass());
    Assert.assertEquals(ManagedState.class,childNode.getCurrentNodeState().getClass());
  }
  state=new DetachedState();
  storeNode=StoreBuilder.buildStoreNode(pc,state,CascadeType.MERGE);
  state.recursivelyPerformOperation(storeNode,OPERATION.MERGE);
  Assert.assertEquals(DetachedState.class,storeNode.getCurrentNodeState().getClass());
  for (  Node childNode : storeNode.getChildren().values()) {
    Assert.assertEquals(BillingCounter.class,childNode.getDataClass());
    Assert.assertEquals(ManagedState.class,childNode.getCurrentNodeState().getClass());
  }
  state=new ManagedState();
  storeNode=StoreBuilder.buildStoreNode(pc,state,CascadeType.REMOVE);
  state.recursivelyPerformOperation(storeNode,OPERATION.REMOVE);
  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());
  }
  state=new DetachedState();
  storeNode=StoreBuilder.buildStoreNode(pc,state,CascadeType.REFRESH);
  try {
    state.recursivelyPerformOperation(storeNode,OPERATION.REFRESH);
    Assert.fail("String_Node_Str");
  }
 catch (  Exception e) {
    Assert.assertEquals(IllegalArgumentException.class,e.getClass());
  }
  state=new ManagedState();
  storeNode=StoreBuilder.buildStoreNode(pc,state,CascadeType.DETACH);
  state.recursivelyPerformOperation(storeNode,OPERATION.DETACH);
  Assert.assertEquals(ManagedState.class,storeNode.getCurrentNodeState().getClass());
  for (  Node childNode : storeNode.getChildren().values()) {
    Assert.assertEquals(BillingCounter.class,childNode.getDataClass());
    Assert.assertEquals(DetachedState.class,childNode.getCurrentNodeState().getClass());
  }
}