Program: 67217
Project: 67217
Buggy source:
public void testCascadeRemove(){
  BeerConsumer beerConsumer=null;
  BlueLight blueLightPersisted=null;
  BlueLight blueLightDetached=null;
  EntityManager em=createEntityManager();
  beginTransaction(em);
  beerConsumer=new BeerConsumer();
  beerConsumer.setName("String_Node_Str");
  blueLightPersisted=new BlueLight();
  beerConsumer.getBlueLightBeersToConsume().add(blueLightPersisted);
  blueLightPersisted.setBeerConsumer(beerConsumer);
  em.persist(beerConsumer);
  blueLightPersisted.setUniqueKey(blueLightPersisted.getId().toBigInteger());
  commitTransaction(em);
  assertTrue(em.contains(beerConsumer));
  assertTrue(em.contains(blueLightPersisted));
  beginTransaction(em);
  blueLightDetached=new BlueLight();
  blueLightDetached.setUniqueKey(new BigDecimal(blueLightPersisted.getUniqueKey().intValue() + 1).toBigInteger());
  beerConsumer.getBlueLightBeersToConsume().add(blueLightDetached);
  blueLightDetached.setBeerConsumer(beerConsumer);
  em.remove(beerConsumer);
  assertFalse(em.contains(blueLightDetached));
  try {
    commitTransaction(em);
  }
 catch (  RuntimeException e) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    fail("String_Node_Str" + e.getMessage() + "String_Node_Str");
  }
  assertFalse("String_Node_Str",em.contains(beerConsumer));
  assertFalse("String_Node_Str",em.contains(blueLightPersisted));
  assertFalse("String_Node_Str",em.contains(blueLightDetached));
  closeEntityManager(em);
}

Fixed version (ground truth):
public void testCascadeRemove(){
  BeerConsumer beerConsumer=null;
  BlueLight blueLightPersisted=null;
  BlueLight blueLightDetached=null;
  EntityManager em=createEntityManager();
  try {
    beginTransaction(em);
    beerConsumer=new BeerConsumer();
    beerConsumer.setName("String_Node_Str");
    blueLightPersisted=new BlueLight();
    beerConsumer.getBlueLightBeersToConsume().add(blueLightPersisted);
    blueLightPersisted.setBeerConsumer(beerConsumer);
    em.persist(beerConsumer);
    blueLightPersisted.setUniqueKey(blueLightPersisted.getId().toBigInteger());
    assertTrue(em.contains(beerConsumer));
    assertTrue(em.contains(blueLightPersisted));
    commitTransaction(em);
  }
 catch (  RuntimeException e) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    throw e;
  }
  try {
    beginTransaction(em);
    blueLightDetached=new BlueLight();
    blueLightDetached.setUniqueKey(new BigDecimal(blueLightPersisted.getUniqueKey().intValue() + 1).toBigInteger());
    beerConsumer.getBlueLightBeersToConsume().add(blueLightDetached);
    blueLightDetached.setBeerConsumer(beerConsumer);
    if (isOnServer()) {
      beerConsumer=em.find(BeerConsumer.class,m_beerConsumerId);
    }
    em.remove(beerConsumer);
    assertFalse(em.contains(blueLightDetached));
  }
 catch (  RuntimeException e) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    throw e;
  }
  try {
    commitTransaction(em);
  }
 catch (  RuntimeException e) {
    if (isTransactionActive(em)) {
      rollbackTransaction(em);
    }
    closeEntityManager(em);
    fail("String_Node_Str" + e.getMessage() + "String_Node_Str");
  }
  assertFalse("String_Node_Str",em.contains(beerConsumer));
  assertFalse("String_Node_Str",em.contains(blueLightPersisted));
  assertFalse("String_Node_Str",em.contains(blueLightDetached));
  closeEntityManager(em);
}