nus-yam/ex-repair huggingface dataset:
Program: 49421
Project: 49421
Buggy source:
@Test public void virtOnlyQuantityChanged(){
  Subscription s=TestUtil.createSubscription(owner,TestUtil.createProduct(owner));
  s.getProduct().addAttribute(new ProductAttribute("String_Node_Str","String_Node_Str"));
  s.setQuantity(10L);
  when(productAdapterMock.getProductById(s.getProduct().getUuid())).thenReturn(s.getProduct());
  Pool p=TestUtil.copyFromSub(s);
  p.addAttribute(new PoolAttribute("String_Node_Str","String_Node_Str"));
  p.addAttribute(new PoolAttribute("String_Node_Str","String_Node_Str"));
  p.setQuantity(40L);
  List<Pool> existingPools=Arrays.asList(p);
  List<PoolUpdate> updates=this.poolRules.updatePools(s,existingPools);
  assertEquals(1,updates.size());
  PoolUpdate update=updates.get(0);
  assertFalse(update.getProductsChanged());
  assertFalse(update.getDatesChanged());
  assertFalse(update.getProductAttributesChanged());
  assertTrue(update.getQuantityChanged());
  assertEquals(Long.valueOf(50),update.getPool().getQuantity());
}

Fixed version (ground truth):
@Test public void virtOnlyQuantityChanged(){
  Subscription s=TestUtil.createSubscription(owner,TestUtil.createProduct(owner));
  s.getProduct().addAttribute(new ProductAttribute("String_Node_Str","String_Node_Str"));
  s.setQuantity(10L);
  when(productAdapterMock.getProductById(s.getProduct().getOwner(),s.getProduct().getId())).thenReturn(s.getProduct());
  Pool p=TestUtil.copyFromSub(s);
  p.addAttribute(new PoolAttribute("String_Node_Str","String_Node_Str"));
  p.addAttribute(new PoolAttribute("String_Node_Str","String_Node_Str"));
  p.setQuantity(40L);
  List<Pool> existingPools=Arrays.asList(p);
  List<PoolUpdate> updates=this.poolRules.updatePools(s,existingPools);
  assertEquals(1,updates.size());
  PoolUpdate update=updates.get(0);
  assertFalse(update.getProductsChanged());
  assertFalse(update.getDatesChanged());
  assertFalse(update.getProductAttributesChanged());
  assertTrue(update.getQuantityChanged());
  assertEquals(Long.valueOf(50),update.getPool().getQuantity());
}
Program: 49422
Project: 49422
Buggy source:
@Test public void updatePoolWithModifiedProductAttributes(){
  Subscription s=TestUtil.createSubscription(owner,TestUtil.createProduct(owner));
  Pool p=TestUtil.copyFromSub(s);
  String testAttributeKey="String_Node_Str";
  String expectedAttributeValue="String_Node_Str";
  p.getProduct().setAttribute(testAttributeKey,"String_Node_Str");
  s.getProduct().setAttribute(testAttributeKey,expectedAttributeValue);
  when(productAdapterMock.getProductById(s.getProduct().getUuid())).thenReturn(s.getProduct());
  List<Pool> existingPools=new LinkedList<Pool>();
  existingPools.add(p);
  List<PoolUpdate> updates=this.poolRules.updatePools(s,existingPools);
  assertEquals(1,updates.size());
  PoolUpdate update=updates.get(0);
  Pool updatedPool=update.getPool();
  assertNotNull(updatedPool.getProduct());
  assertTrue(updatedPool.getProduct().hasAttribute(testAttributeKey));
  assertEquals(expectedAttributeValue,updatedPool.getProduct().getAttributeValue(testAttributeKey));
}

Fixed version (ground truth):
@Test public void updatePoolWithModifiedProductAttributes(){
  Subscription s=TestUtil.createSubscription(owner,TestUtil.createProduct(owner));
  Pool p=TestUtil.copyFromSub(s);
  String testAttributeKey="String_Node_Str";
  String expectedAttributeValue="String_Node_Str";
  p.getProduct().setAttribute(testAttributeKey,"String_Node_Str");
  s.getProduct().setAttribute(testAttributeKey,expectedAttributeValue);
  when(productAdapterMock.getProductById(s.getProduct().getOwner(),s.getProduct().getId())).thenReturn(s.getProduct());
  List<Pool> existingPools=new LinkedList<Pool>();
  existingPools.add(p);
  List<PoolUpdate> updates=this.poolRules.updatePools(s,existingPools);
  assertEquals(1,updates.size());
  PoolUpdate update=updates.get(0);
  Pool updatedPool=update.getPool();
  assertNotNull(updatedPool.getProduct());
  assertTrue(updatedPool.getProduct().hasAttribute(testAttributeKey));
  assertEquals(expectedAttributeValue,updatedPool.getProduct().getAttributeValue(testAttributeKey));
}
Program: 49423
Project: 49423
Buggy source:
@Test public void subProductIdCopiedOntoPoolWhenCreatingNewPool(){
  Product product=TestUtil.createProduct(owner);
  Product subProduct=TestUtil.createProduct(owner);
  Subscription sub=TestUtil.createSubscription(owner,product);
  sub.setDerivedProduct(subProduct);
  when(this.productAdapterMock.getProductById(anyString())).thenReturn(product);
  when(this.productAdapterMock.getProductById(anyString())).thenReturn(subProduct);
  List<Pool> pools=this.poolRules.createPools(sub);
  assertEquals(1,pools.size());
  Pool resultPool=pools.get(0);
  assertEquals(subProduct,resultPool.getDerivedProduct());
}

Fixed version (ground truth):
@Test public void subProductIdCopiedOntoPoolWhenCreatingNewPool(){
  Product product=TestUtil.createProduct(owner);
  Product subProduct=TestUtil.createProduct(owner);
  Subscription sub=TestUtil.createSubscription(owner,product);
  sub.setDerivedProduct(subProduct);
  when(this.productAdapterMock.getProductById(product.getOwner(),product.getId())).thenReturn(product);
  when(this.productAdapterMock.getProductById(subProduct.getOwner(),subProduct.getId())).thenReturn(subProduct);
  List<Pool> pools=this.poolRules.createPools(sub);
  assertEquals(1,pools.size());
  Pool resultPool=pools.get(0);
  assertEquals(subProduct,resultPool.getDerivedProduct());
}
Program: 49424
Project: 49424
Buggy source:
@Test public void subProductAttributesCopiedOntoPoolWhenCreatingNewPool(){
  Product product=TestUtil.createProduct(owner);
  Product subProduct=TestUtil.createProduct(owner);
  Subscription sub=TestUtil.createSubscription(owner,product);
  sub.setDerivedProduct(subProduct);
  String testAttributeKey="String_Node_Str";
  String expectedAttributeValue="String_Node_Str";
  subProduct.setAttribute(testAttributeKey,expectedAttributeValue);
  when(this.productAdapterMock.getProductById(anyString())).thenReturn(product);
  when(this.productAdapterMock.getProductById(anyString())).thenReturn(subProduct);
  List<Pool> pools=this.poolRules.createPools(sub);
  assertEquals(1,pools.size());
  Pool resultPool=pools.get(0);
  assertNotNull(resultPool.getDerivedProduct());
  assertTrue(resultPool.getDerivedProduct().hasAttribute(testAttributeKey));
  assertEquals(expectedAttributeValue,resultPool.getDerivedProduct().getAttributeValue(testAttributeKey));
}

Fixed version (ground truth):
@Test public void subProductAttributesCopiedOntoPoolWhenCreatingNewPool(){
  Product product=TestUtil.createProduct(owner);
  Product subProduct=TestUtil.createProduct(owner);
  Subscription sub=TestUtil.createSubscription(owner,product);
  sub.setDerivedProduct(subProduct);
  String testAttributeKey="String_Node_Str";
  String expectedAttributeValue="String_Node_Str";
  subProduct.setAttribute(testAttributeKey,expectedAttributeValue);
  when(this.productAdapterMock.getProductById(product.getOwner(),product.getId())).thenReturn(product);
  when(this.productAdapterMock.getProductById(subProduct.getOwner(),subProduct.getId())).thenReturn(subProduct);
  List<Pool> pools=this.poolRules.createPools(sub);
  assertEquals(1,pools.size());
  Pool resultPool=pools.get(0);
  assertNotNull(resultPool.getDerivedProduct());
  assertTrue(resultPool.getDerivedProduct().hasAttribute(testAttributeKey));
  assertEquals(expectedAttributeValue,resultPool.getDerivedProduct().getAttributeValue(testAttributeKey));
}
Program: 49425
Project: 49425
Buggy source:
@Test public void dontUpdateVirtOnlyNoVirtLimit(){
  when(configMock.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
  Subscription s=TestUtil.createSubscription(owner,TestUtil.createProduct(owner));
  s.setQuantity(10L);
  when(productAdapterMock.getProductById(s.getProduct().getUuid())).thenReturn(s.getProduct());
  Pool p=TestUtil.copyFromSub(s);
  p.addAttribute(new PoolAttribute("String_Node_Str","String_Node_Str"));
  p.addAttribute(new PoolAttribute("String_Node_Str","String_Node_Str"));
  p.setQuantity(10L);
  List<Pool> existingPools=new LinkedList<Pool>();
  existingPools.add(p);
  List<PoolUpdate> updates=this.poolRules.updatePools(s,existingPools);
  assertEquals(0,updates.size());
}

Fixed version (ground truth):
@Test public void dontUpdateVirtOnlyNoVirtLimit(){
  when(configMock.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
  Subscription s=TestUtil.createSubscription(owner,TestUtil.createProduct(owner));
  s.setQuantity(10L);
  when(productAdapterMock.getProductById(s.getProduct().getOwner(),s.getProduct().getId())).thenReturn(s.getProduct());
  Pool p=TestUtil.copyFromSub(s);
  p.addAttribute(new PoolAttribute("String_Node_Str","String_Node_Str"));
  p.addAttribute(new PoolAttribute("String_Node_Str","String_Node_Str"));
  p.setQuantity(10L);
  List<Pool> existingPools=new LinkedList<Pool>();
  existingPools.add(p);
  List<PoolUpdate> updates=this.poolRules.updatePools(s,existingPools);
  assertEquals(0,updates.size());
}
Program: 49426
Project: 49426
Buggy source:
@Test public void updatePoolWithNewProductAttributes(){
  Subscription s=TestUtil.createSubscription(owner,TestUtil.createProduct(owner));
  Pool p=TestUtil.copyFromSub(s);
  String testAttributeKey="String_Node_Str";
  s.getProduct().setAttribute(testAttributeKey,"String_Node_Str");
  when(productAdapterMock.getProductById(s.getProduct().getUuid())).thenReturn(s.getProduct());
  List<Pool> existingPools=Arrays.asList(p);
  List<PoolUpdate> updates=this.poolRules.updatePools(s,existingPools);
  assertEquals(1,updates.size());
  PoolUpdate update=updates.get(0);
  Pool updatedPool=update.getPool();
  assertNotNull(updatedPool.getProduct());
  assertTrue(updatedPool.getProduct().hasAttribute(testAttributeKey));
}

Fixed version (ground truth):
@Test public void updatePoolWithNewProductAttributes(){
  Subscription s=TestUtil.createSubscription(owner,TestUtil.createProduct(owner));
  Pool p=TestUtil.copyFromSub(s);
  String testAttributeKey="String_Node_Str";
  s.getProduct().setAttribute(testAttributeKey,"String_Node_Str");
  when(productAdapterMock.getProductById(s.getProduct().getOwner(),s.getProduct().getId())).thenReturn(s.getProduct());
  List<Pool> existingPools=Arrays.asList(p);
  List<PoolUpdate> updates=this.poolRules.updatePools(s,existingPools);
  assertEquals(1,updates.size());
  PoolUpdate update=updates.get(0);
  Pool updatedPool=update.getPool();
  assertNotNull(updatedPool.getProduct());
  assertTrue(updatedPool.getProduct().hasAttribute(testAttributeKey));
}
Program: 49427
Project: 49427
Buggy source:
private Subscription createVirtOnlySub(String productId,int quantity){
  Product product=new Product(productId,productId,owner);
  product.setAttribute("String_Node_Str","String_Node_Str");
  when(productAdapterMock.getProductById(productId)).thenReturn(product);
  Subscription s=TestUtil.createSubscription(product);
  s.setQuantity(new Long(quantity));
  return s;
}

Fixed version (ground truth):
private Subscription createVirtOnlySub(String productId,int quantity){
  Product product=new Product(productId,productId,owner);
  product.setAttribute("String_Node_Str","String_Node_Str");
  when(productAdapterMock.getProductById(product.getOwner(),product.getId())).thenReturn(product);
  Subscription s=TestUtil.createSubscription(product);
  s.setQuantity(new Long(quantity));
  return s;
}
Program: 49428
Project: 49428
Buggy source:
private Subscription createSubscriptionWithSubProduct(){
  Subscription s=TestUtil.createSubscription(owner,TestUtil.createProduct(owner));
  Product subProd=TestUtil.createProduct(owner);
  s.setDerivedProduct(subProd);
  when(productAdapterMock.getProductById(s.getProduct().getUuid())).thenReturn(s.getProduct());
  when(productAdapterMock.getProductById(s.getDerivedProduct().getUuid())).thenReturn(s.getDerivedProduct());
  return s;
}

Fixed version (ground truth):
private Subscription createSubscriptionWithSubProduct(){
  Subscription s=TestUtil.createSubscription(owner,TestUtil.createProduct(owner));
  Product subProd=TestUtil.createProduct(owner);
  s.setDerivedProduct(subProd);
  when(productAdapterMock.getProductById(s.getProduct().getOwner(),s.getProduct().getId())).thenReturn(s.getProduct());
  when(productAdapterMock.getProductById(s.getDerivedProduct().getOwner(),s.getDerivedProduct().getId())).thenReturn(s.getDerivedProduct());
  return s;
}
Program: 49429
Project: 49429
Buggy source:
protected Subscription createVirtLimitSub(String productId,int quantity,String virtLimit){
  Product product=new Product(productId,productId,owner);
  product.setAttribute("String_Node_Str",virtLimit);
  when(prodAdapter.getProductById(productId)).thenReturn(product);
  Subscription s=TestUtil.createSubscription(product);
  s.setQuantity(new Long(quantity));
  s.setId("String_Node_Str");
  return s;
}

Fixed version (ground truth):
protected Subscription createVirtLimitSub(String productId,int quantity,String virtLimit){
  Product product=new Product(productId,productId,owner);
  product.setAttribute("String_Node_Str",virtLimit);
  when(prodAdapter.getProductById(owner,productId)).thenReturn(product);
  Subscription s=TestUtil.createSubscription(product);
  s.setQuantity(new Long(quantity));
  s.setId("String_Node_Str");
  return s;
}
Program: 49430
Project: 49430
Buggy source:
protected Pool setupVirtLimitPool(){
  Product product=new Product(productId,"String_Node_Str",owner);
  Pool pool=TestUtil.createPool(owner,product);
  pool.addAttribute(new PoolAttribute("String_Node_Str","String_Node_Str"));
  pool.setId("String_Node_Str" + TestUtil.randomInt());
  when(this.prodAdapter.getProductById(productId)).thenReturn(product);
  return pool;
}

Fixed version (ground truth):
protected Pool setupVirtLimitPool(){
  Product product=new Product(productId,"String_Node_Str",owner);
  Pool pool=TestUtil.createPool(owner,product);
  pool.addAttribute(new PoolAttribute("String_Node_Str","String_Node_Str"));
  pool.setId("String_Node_Str" + TestUtil.randomInt());
  when(this.prodAdapter.getProductById(owner,productId)).thenReturn(product);
  return pool;
}
Program: 49431
Project: 49431
Buggy source:
@Test public void hostedVirtLimitWithHostLimitedCreatesBonusPoolsOnBind(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
  Subscription s=createVirtLimitSub("String_Node_Str",10,"String_Node_Str");
  s.getProduct().setAttribute("String_Node_Str","String_Node_Str");
  List<Pool> pools=poolRules.createPools(s);
  assertEquals(2,pools.size());
  Pool physicalPool=pools.get(0);
  physicalPool.setId("String_Node_Str");
  assertEquals(new Long(10),physicalPool.getQuantity());
  assertEquals(0,physicalPool.getAttributes().size());
  Entitlement e=new Entitlement(physicalPool,consumer,1);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,productCache,e);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock).createPool(any(Pool.class));
}

Fixed version (ground truth):
@Test public void hostedVirtLimitWithHostLimitedCreatesBonusPoolsOnBind(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
  Subscription s=createVirtLimitSub("String_Node_Str",10,"String_Node_Str");
  s.getProduct().setAttribute("String_Node_Str","String_Node_Str");
  List<Pool> pools=poolRules.createPools(s);
  assertEquals(2,pools.size());
  Pool physicalPool=pools.get(0);
  physicalPool.setId("String_Node_Str");
  assertEquals(new Long(10),physicalPool.getQuantity());
  assertEquals(0,physicalPool.getAttributes().size());
  Entitlement e=new Entitlement(physicalPool,consumer,1);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,e);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock).createPool(any(Pool.class));
}
Program: 49432
Project: 49432
Buggy source:
@Test public void hostedVirtLimitUnlimitedBonusPoolQuantity(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
  Subscription s=createVirtLimitSub("String_Node_Str",10,"String_Node_Str");
  List<Pool> pools=poolRules.createPools(s);
  assertEquals(2,pools.size());
  Pool physicalPool=pools.get(0);
  physicalPool.setId("String_Node_Str");
  Pool virtBonusPool=pools.get(1);
  virtBonusPool.setId("String_Node_Str");
  assertEquals(new Long(10),physicalPool.getQuantity());
  assertEquals(0,physicalPool.getAttributes().size());
  assertEquals(new Long(-1),virtBonusPool.getQuantity());
  assertEquals("String_Node_Str",virtBonusPool.getAttributeValue("String_Node_Str"));
  assertEquals("String_Node_Str",virtBonusPool.getProduct().getAttributeValue("String_Node_Str"));
  Entitlement e=new Entitlement(physicalPool,consumer,1);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,productCache,e);
  List<Pool> poolList=new ArrayList<Pool>();
  poolList.add(virtBonusPool);
  when(poolManagerMock.lookupBySubscriptionId(eq(physicalPool.getSubscriptionId()))).thenReturn(poolList);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
  enforcer.postUnbind(consumer,postHelper,e);
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
}

Fixed version (ground truth):
@Test public void hostedVirtLimitUnlimitedBonusPoolQuantity(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
  Subscription s=createVirtLimitSub("String_Node_Str",10,"String_Node_Str");
  List<Pool> pools=poolRules.createPools(s);
  assertEquals(2,pools.size());
  Pool physicalPool=pools.get(0);
  physicalPool.setId("String_Node_Str");
  Pool virtBonusPool=pools.get(1);
  virtBonusPool.setId("String_Node_Str");
  assertEquals(new Long(10),physicalPool.getQuantity());
  assertEquals(0,physicalPool.getAttributes().size());
  assertEquals(new Long(-1),virtBonusPool.getQuantity());
  assertEquals("String_Node_Str",virtBonusPool.getAttributeValue("String_Node_Str"));
  assertEquals("String_Node_Str",virtBonusPool.getProduct().getAttributeValue("String_Node_Str"));
  Entitlement e=new Entitlement(physicalPool,consumer,1);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,e);
  List<Pool> poolList=new ArrayList<Pool>();
  poolList.add(virtBonusPool);
  when(poolManagerMock.lookupBySubscriptionId(eq(physicalPool.getSubscriptionId()))).thenReturn(poolList);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
  enforcer.postUnbind(consumer,postHelper,e);
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
}
Program: 49433
Project: 49433
Buggy source:
@Test public void hostedVirtLimitDoesNotAlterQuantitiesForHostLimited(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
  consumer.setType(new ConsumerType(ConsumerTypeEnum.CANDLEPIN));
  Pool virtBonusPool=setupVirtLimitPool();
  virtBonusPool.setQuantity(100L);
  virtBonusPool.setAttribute("String_Node_Str","String_Node_Str");
  virtBonusPool.setAttribute("String_Node_Str","String_Node_Str");
  virtBonusPool.setAttribute("String_Node_Str","String_Node_Str");
  virtBonusPool.setAttribute("String_Node_Str","String_Node_Str");
  Entitlement e=new Entitlement(virtBonusPool,consumer,1);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,productCache,e);
  List<Pool> poolList=new ArrayList<Pool>();
  poolList.add(virtBonusPool);
  when(poolManagerMock.lookupBySubscriptionId(eq(virtBonusPool.getSubscriptionId()))).thenReturn(poolList);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock,never()).updatePoolQuantity(eq(virtBonusPool),eq(-10L));
  enforcer.postUnbind(consumer,postHelper,e);
  verify(poolManagerMock,never()).updatePoolQuantity(eq(virtBonusPool),eq(10L));
}

Fixed version (ground truth):
@Test public void hostedVirtLimitDoesNotAlterQuantitiesForHostLimited(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
  consumer.setType(new ConsumerType(ConsumerTypeEnum.CANDLEPIN));
  Pool virtBonusPool=setupVirtLimitPool();
  virtBonusPool.setQuantity(100L);
  virtBonusPool.setAttribute("String_Node_Str","String_Node_Str");
  virtBonusPool.setAttribute("String_Node_Str","String_Node_Str");
  virtBonusPool.setAttribute("String_Node_Str","String_Node_Str");
  virtBonusPool.setAttribute("String_Node_Str","String_Node_Str");
  Entitlement e=new Entitlement(virtBonusPool,consumer,1);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,e);
  List<Pool> poolList=new ArrayList<Pool>();
  poolList.add(virtBonusPool);
  when(poolManagerMock.lookupBySubscriptionId(eq(virtBonusPool.getSubscriptionId()))).thenReturn(poolList);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock,never()).updatePoolQuantity(eq(virtBonusPool),eq(-10L));
  enforcer.postUnbind(consumer,postHelper,e);
  verify(poolManagerMock,never()).updatePoolQuantity(eq(virtBonusPool),eq(10L));
}
Program: 49434
Project: 49434
Buggy source:
@Test public void exportAllPhysicalZeroBonusPoolQuantity(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
  consumer.setType(new ConsumerType(ConsumerTypeEnum.CANDLEPIN));
  Subscription s=createVirtLimitSub("String_Node_Str",10,"String_Node_Str");
  List<Pool> pools=poolRules.createPools(s);
  assertEquals(2,pools.size());
  Pool physicalPool=pools.get(0);
  physicalPool.setId("String_Node_Str");
  Pool virtBonusPool=pools.get(1);
  virtBonusPool.setId("String_Node_Str");
  assertEquals(new Long(10),physicalPool.getQuantity());
  assertEquals(0,physicalPool.getAttributes().size());
  assertEquals(new Long(-1),virtBonusPool.getQuantity());
  assertEquals("String_Node_Str",virtBonusPool.getAttributeValue("String_Node_Str"));
  assertEquals("String_Node_Str",virtBonusPool.getProduct().getAttributeValue("String_Node_Str"));
  Entitlement e=new Entitlement(physicalPool,consumer,10);
  physicalPool.setConsumed(10L);
  physicalPool.setExported(10L);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,productCache,e);
  List<Pool> poolList=new ArrayList<Pool>();
  poolList.add(virtBonusPool);
  when(poolManagerMock.lookupBySubscriptionId(eq(physicalPool.getSubscriptionId()))).thenReturn(poolList);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock).setPoolQuantity(eq(virtBonusPool),eq(0L));
  virtBonusPool.setQuantity(0L);
  enforcer.postUnbind(consumer,postHelper,e);
  verify(poolManagerMock).setPoolQuantity(eq(virtBonusPool),eq(-1L));
}

Fixed version (ground truth):
@Test public void exportAllPhysicalZeroBonusPoolQuantity(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
  consumer.setType(new ConsumerType(ConsumerTypeEnum.CANDLEPIN));
  Subscription s=createVirtLimitSub("String_Node_Str",10,"String_Node_Str");
  List<Pool> pools=poolRules.createPools(s);
  assertEquals(2,pools.size());
  Pool physicalPool=pools.get(0);
  physicalPool.setId("String_Node_Str");
  Pool virtBonusPool=pools.get(1);
  virtBonusPool.setId("String_Node_Str");
  assertEquals(new Long(10),physicalPool.getQuantity());
  assertEquals(0,physicalPool.getAttributes().size());
  assertEquals(new Long(-1),virtBonusPool.getQuantity());
  assertEquals("String_Node_Str",virtBonusPool.getAttributeValue("String_Node_Str"));
  assertEquals("String_Node_Str",virtBonusPool.getProduct().getAttributeValue("String_Node_Str"));
  Entitlement e=new Entitlement(physicalPool,consumer,10);
  physicalPool.setConsumed(10L);
  physicalPool.setExported(10L);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,e);
  List<Pool> poolList=new ArrayList<Pool>();
  poolList.add(virtBonusPool);
  when(poolManagerMock.lookupBySubscriptionId(eq(physicalPool.getSubscriptionId()))).thenReturn(poolList);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock).setPoolQuantity(eq(virtBonusPool),eq(0L));
  virtBonusPool.setQuantity(0L);
  enforcer.postUnbind(consumer,postHelper,e);
  verify(poolManagerMock).setPoolQuantity(eq(virtBonusPool),eq(-1L));
}
Program: 49435
Project: 49435
Buggy source:
@Test public void noBonusPoolsForHostedNonDistributorBinds(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
  Subscription s=createVirtLimitSub("String_Node_Str",10,"String_Node_Str");
  List<Pool> pools=poolRules.createPools(s);
  assertEquals(2,pools.size());
  Pool physicalPool=pools.get(0);
  physicalPool.setId("String_Node_Str");
  Pool virtBonusPool=pools.get(1);
  virtBonusPool.setId("String_Node_Str");
  assertEquals(new Long(10),physicalPool.getQuantity());
  assertEquals(0,physicalPool.getAttributes().size());
  assertEquals(new Long(-1),virtBonusPool.getQuantity());
  assertEquals("String_Node_Str",virtBonusPool.getAttributeValue("String_Node_Str"));
  assertEquals("String_Node_Str",virtBonusPool.getProduct().getAttributeValue("String_Node_Str"));
  Entitlement e=new Entitlement(physicalPool,consumer,1);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,productCache,e);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock,never()).createPool(any(Pool.class));
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
  enforcer.postUnbind(consumer,postHelper,e);
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
  verify(poolManagerMock,never()).setPoolQuantity(any(Pool.class),anyLong());
}

Fixed version (ground truth):
@Test public void noBonusPoolsForHostedNonDistributorBinds(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
  Subscription s=createVirtLimitSub("String_Node_Str",10,"String_Node_Str");
  List<Pool> pools=poolRules.createPools(s);
  assertEquals(2,pools.size());
  Pool physicalPool=pools.get(0);
  physicalPool.setId("String_Node_Str");
  Pool virtBonusPool=pools.get(1);
  virtBonusPool.setId("String_Node_Str");
  assertEquals(new Long(10),physicalPool.getQuantity());
  assertEquals(0,physicalPool.getAttributes().size());
  assertEquals(new Long(-1),virtBonusPool.getQuantity());
  assertEquals("String_Node_Str",virtBonusPool.getAttributeValue("String_Node_Str"));
  assertEquals("String_Node_Str",virtBonusPool.getProduct().getAttributeValue("String_Node_Str"));
  Entitlement e=new Entitlement(physicalPool,consumer,1);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,e);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock,never()).createPool(any(Pool.class));
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
  enforcer.postUnbind(consumer,postHelper,e);
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
  verify(poolManagerMock,never()).setPoolQuantity(any(Pool.class),anyLong());
}
Program: 49436
Project: 49436
Buggy source:
@Test public void hostedVirtLimitAltersBonusPoolQuantity(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
  Subscription s=createVirtLimitSub("String_Node_Str",10,"String_Node_Str");
  consumer.setType(new ConsumerType(ConsumerTypeEnum.CANDLEPIN));
  List<Pool> pools=poolRules.createPools(s);
  assertEquals(2,pools.size());
  Pool physicalPool=pools.get(0);
  physicalPool.setId("String_Node_Str");
  Pool virtBonusPool=pools.get(1);
  virtBonusPool.setId("String_Node_Str");
  assertEquals(new Long(10),physicalPool.getQuantity());
  assertEquals(0,physicalPool.getAttributes().size());
  assertEquals(new Long(100),virtBonusPool.getQuantity());
  assertEquals("String_Node_Str",virtBonusPool.getAttributeValue("String_Node_Str"));
  assertEquals("String_Node_Str",virtBonusPool.getProduct().getAttributeValue("String_Node_Str"));
  Entitlement e=new Entitlement(physicalPool,consumer,1);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,productCache,e);
  List<Pool> poolList=new ArrayList<Pool>();
  poolList.add(virtBonusPool);
  when(poolManagerMock.lookupBySubscriptionId(eq(physicalPool.getSubscriptionId()))).thenReturn(poolList);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock).updatePoolQuantity(eq(virtBonusPool),eq(-10L));
  enforcer.postUnbind(consumer,postHelper,e);
  verify(poolManagerMock).updatePoolQuantity(eq(virtBonusPool),eq(10L));
}

Fixed version (ground truth):
@Test public void hostedVirtLimitAltersBonusPoolQuantity(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(false);
  Subscription s=createVirtLimitSub("String_Node_Str",10,"String_Node_Str");
  consumer.setType(new ConsumerType(ConsumerTypeEnum.CANDLEPIN));
  List<Pool> pools=poolRules.createPools(s);
  assertEquals(2,pools.size());
  Pool physicalPool=pools.get(0);
  physicalPool.setId("String_Node_Str");
  Pool virtBonusPool=pools.get(1);
  virtBonusPool.setId("String_Node_Str");
  assertEquals(new Long(10),physicalPool.getQuantity());
  assertEquals(0,physicalPool.getAttributes().size());
  assertEquals(new Long(100),virtBonusPool.getQuantity());
  assertEquals("String_Node_Str",virtBonusPool.getAttributeValue("String_Node_Str"));
  assertEquals("String_Node_Str",virtBonusPool.getProduct().getAttributeValue("String_Node_Str"));
  Entitlement e=new Entitlement(physicalPool,consumer,1);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,e);
  List<Pool> poolList=new ArrayList<Pool>();
  poolList.add(virtBonusPool);
  when(poolManagerMock.lookupBySubscriptionId(eq(physicalPool.getSubscriptionId()))).thenReturn(poolList);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock).updatePoolQuantity(eq(virtBonusPool),eq(-10L));
  enforcer.postUnbind(consumer,postHelper,e);
  verify(poolManagerMock).updatePoolQuantity(eq(virtBonusPool),eq(10L));
}
Program: 49437
Project: 49437
Buggy source:
@Test public void postEntitlement(){
  Consumer c=mock(Consumer.class);
  PoolHelper ph=mock(PoolHelper.class);
  Entitlement e=mock(Entitlement.class);
  ConsumerType type=mock(ConsumerType.class);
  Pool pool=mock(Pool.class);
  Product product=mock(Product.class);
  when(e.getPool()).thenReturn(pool);
  when(e.getConsumer()).thenReturn(c);
  when(c.getType()).thenReturn(type);
  when(type.isManifest()).thenReturn(true);
  when(pool.getProductId()).thenReturn("String_Node_Str");
  when(prodAdapter.getProductById(eq("String_Node_Str"))).thenReturn(product);
  when(product.getAttributes()).thenReturn(new HashSet<ProductAttribute>());
  when(pool.getAttributes()).thenReturn(new HashSet<PoolAttribute>());
  assertEquals(ph,enforcer.postEntitlement(c,ph,e));
}

Fixed version (ground truth):
@Test public void postEntitlement(){
  Consumer c=mock(Consumer.class);
  PoolHelper ph=mock(PoolHelper.class);
  Entitlement e=mock(Entitlement.class);
  ConsumerType type=mock(ConsumerType.class);
  Pool pool=mock(Pool.class);
  Product product=mock(Product.class);
  Owner owner=mock(Owner.class);
  when(e.getPool()).thenReturn(pool);
  when(e.getConsumer()).thenReturn(c);
  when(c.getType()).thenReturn(type);
  when(type.isManifest()).thenReturn(true);
  when(pool.getProductId()).thenReturn("String_Node_Str");
  when(prodAdapter.getProductById(eq(owner),eq("String_Node_Str"))).thenReturn(product);
  when(product.getAttributes()).thenReturn(new HashSet<ProductAttribute>());
  when(pool.getAttributes()).thenReturn(new HashSet<PoolAttribute>());
  assertEquals(ph,enforcer.postEntitlement(c,ph,e));
}
Program: 49438
Project: 49438
Buggy source:
@Test public void noSubPoolsForDistributorBinds(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(true);
  consumer.setType(new ConsumerType(ConsumerTypeEnum.CANDLEPIN));
  Pool pool=setupVirtLimitPool();
  Entitlement e=new Entitlement(pool,consumer,1);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,productCache,e);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock,never()).createPool(any(Pool.class));
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
  enforcer.postUnbind(consumer,postHelper,e);
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
  verify(poolManagerMock,never()).setPoolQuantity(any(Pool.class),anyLong());
}

Fixed version (ground truth):
@Test public void noSubPoolsForDistributorBinds(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(true);
  consumer.setType(new ConsumerType(ConsumerTypeEnum.CANDLEPIN));
  Pool pool=setupVirtLimitPool();
  Entitlement e=new Entitlement(pool,consumer,1);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,e);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock,never()).createPool(any(Pool.class));
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
  enforcer.postUnbind(consumer,postHelper,e);
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
  verify(poolManagerMock,never()).setPoolQuantity(any(Pool.class),anyLong());
}
Program: 49439
Project: 49439
Buggy source:
@Test public void noSubPoolsForGuestBinds(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(true);
  Pool pool=setupVirtLimitPool();
  consumer.setFact("String_Node_Str","String_Node_Str");
  Entitlement e=new Entitlement(pool,consumer,1);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,productCache,e);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock,never()).createPool(any(Pool.class));
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
  enforcer.postUnbind(consumer,postHelper,e);
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
  verify(poolManagerMock,never()).setPoolQuantity(any(Pool.class),anyLong());
}

Fixed version (ground truth):
@Test public void noSubPoolsForGuestBinds(){
  when(config.getBoolean(ConfigProperties.STANDALONE)).thenReturn(true);
  Pool pool=setupVirtLimitPool();
  consumer.setFact("String_Node_Str","String_Node_Str");
  Entitlement e=new Entitlement(pool,consumer,1);
  PoolHelper postHelper=new PoolHelper(poolManagerMock,e);
  enforcer.postEntitlement(consumer,postHelper,e);
  verify(poolManagerMock,never()).createPool(any(Pool.class));
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
  enforcer.postUnbind(consumer,postHelper,e);
  verify(poolManagerMock,never()).updatePoolQuantity(any(Pool.class),anyInt());
  verify(poolManagerMock,never()).setPoolQuantity(any(Pool.class),anyLong());
}
Program: 49440
Project: 49440
Buggy source:
@Override public int hashCode(){
  return productId.hashCode() * 31;
}

Fixed version (ground truth):
@Override public int hashCode(){
  if (productId != null) {
    return productId.hashCode() * 31;
  }
  return 31;
}
Program: 49441
Project: 49441
Buggy source:
@Override public String getHref(){
  return "String_Node_Str" + getId();
}

Fixed version (ground truth):
@Override public String getHref(){
  return "String_Node_Str" + getOwner().getKey() + "String_Node_Str"+ getProductId();
}
Program: 49442
Project: 49442
Buggy source:
@Override public boolean equals(Object anObject){
  if (this == anObject) {
    return true;
  }
  if (!(anObject instanceof Product)) {
    return false;
  }
  Product another=(Product)anObject;
  return id.equals(another.getProductId()) && name.equals(another.getName());
}

Fixed version (ground truth):
@Override public boolean equals(Object anObject){
  if (this == anObject) {
    return true;
  }
  if (!(anObject instanceof Product)) {
    return false;
  }
  Product another=(Product)anObject;
  return getProductId().equals(another.getProductId()) && name.equals(another.getName());
}
Program: 49443
Project: 49443
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + id + "String_Node_Str"+ name+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + productId + "String_Node_Str"+ name+ "String_Node_Str";
}
Program: 49444
Project: 49444
Buggy source:
/** 
 * Create the given product if it does not already exist, otherwise update existing product.
 * @param p Product to create or update.
 */
public void createOrUpdate(Product p){
  Product existing=lookupById(p.getId());
  if (existing == null) {
    create(p);
  }
 else {
    merge(p);
  }
}

Fixed version (ground truth):
/** 
 * Create the given product if it does not already exist, otherwise update existing product.
 * @param p Product to create or update.
 */
public void createOrUpdate(Product p){
  Product existing=lookupById(p.getOwner(),p.getProductId());
  if (existing == null) {
    create(p);
  }
 else {
    copy(p,existing);
    merge(existing);
  }
}
Program: 49445
Project: 49445
Buggy source:
@Inject public UnmappedGuestEntitlementCleanerJob(EntitlementCurator entitlementCurator,PoolManager manager){
  this.entitlementCurator=entitlementCurator;
  this.poolManager=manager;
}

Fixed version (ground truth):
@Inject public UnmappedGuestEntitlementCleanerJob(EntitlementCurator entitlementCurator,PoolManager manager,SubscriptionServiceAdapter subAdapter){
  this.entitlementCurator=entitlementCurator;
  this.poolManager=manager;
  this.subAdapter=subAdapter;
}
Program: 49446
Project: 49446
Buggy source:
@Override public void toExecute(JobExecutionContext context) throws JobExecutionException {
  Date now=new Date();
  List<Entitlement> unmappedGuestEntitlements=entitlementCurator.findByPoolAttribute("String_Node_Str","String_Node_Str");
  int total=0;
  for (  Entitlement e : unmappedGuestEntitlements) {
    if (isLapsed(e,now)) {
      poolManager.revokeEntitlement(e);
      total++;
    }
  }
  if (total > 0) {
    log.info("String_Node_Str",total);
  }
 else {
    log.debug("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void toExecute(JobExecutionContext context) throws JobExecutionException {
  Date now=new Date();
  List<Entitlement> unmappedGuestEntitlements=entitlementCurator.findByPoolAttribute("String_Node_Str","String_Node_Str");
  int total=0;
  for (  Entitlement e : unmappedGuestEntitlements) {
    if (isLapsed(e,now)) {
      poolManager.revokeEntitlement(subAdapter,e);
      total++;
    }
  }
  if (total > 0) {
    log.info("String_Node_Str",total);
  }
 else {
    log.debug("String_Node_Str");
  }
}
Program: 49447
Project: 49447
Buggy source:
@Test public void testToExecute() throws Exception {
  Owner owner1=new Owner("String_Node_Str");
  Owner owner2=new Owner("String_Node_Str");
  Product product1=TestUtil.createProduct(owner1);
  Product product2=TestUtil.createProduct(owner2);
  Pool p1=TestUtil.createPool(owner1,product1);
  Pool p2=TestUtil.createPool(owner2,product2);
  p1.addAttribute(new PoolAttribute("String_Node_Str","String_Node_Str"));
  p2.addAttribute(new PoolAttribute("String_Node_Str","String_Node_Str"));
  Date thirtySixHoursAgo=new Date(new Date().getTime() - 36L * 60L * 60L* 1000L);
  Date twelveHoursAgo=new Date(new Date().getTime() - 12L * 60L * 60L* 1000L);
  Consumer c;
  c=TestUtil.createConsumer(owner1);
  c.setCreated(thirtySixHoursAgo);
  Entitlement e1=TestUtil.createEntitlement(owner1,c,p1,null);
  Set<Entitlement> entitlementSet1=new HashSet<Entitlement>();
  entitlementSet1.add(e1);
  p1.setEntitlements(entitlementSet1);
  c=TestUtil.createConsumer(owner2);
  c.setCreated(twelveHoursAgo);
  Entitlement e2=TestUtil.createEntitlement(owner2,c,p2,null);
  Set<Entitlement> entitlementSet2=new HashSet<Entitlement>();
  entitlementSet2.add(e2);
  p2.setEntitlements(entitlementSet2);
  when(entitlementCurator.findByPoolAttribute(eq("String_Node_Str"),eq("String_Node_Str"))).thenReturn(Arrays.asList(new Entitlement[]{e1,e2}));
  new UnmappedGuestEntitlementCleanerJob(entitlementCurator,poolManager).execute(null);
  verify(poolManager).revokeEntitlement(e1);
}

Fixed version (ground truth):
@Test public void testToExecute() throws Exception {
  Owner owner1=new Owner("String_Node_Str");
  Owner owner2=new Owner("String_Node_Str");
  Product product1=TestUtil.createProduct(owner1);
  Product product2=TestUtil.createProduct(owner2);
  Pool p1=TestUtil.createPool(owner1,product1);
  Pool p2=TestUtil.createPool(owner2,product2);
  p1.addAttribute(new PoolAttribute("String_Node_Str","String_Node_Str"));
  p2.addAttribute(new PoolAttribute("String_Node_Str","String_Node_Str"));
  Date thirtySixHoursAgo=new Date(new Date().getTime() - 36L * 60L * 60L* 1000L);
  Date twelveHoursAgo=new Date(new Date().getTime() - 12L * 60L * 60L* 1000L);
  Consumer c;
  c=TestUtil.createConsumer(owner1);
  c.setCreated(thirtySixHoursAgo);
  Entitlement e1=TestUtil.createEntitlement(owner1,c,p1,null);
  Set<Entitlement> entitlementSet1=new HashSet<Entitlement>();
  entitlementSet1.add(e1);
  p1.setEntitlements(entitlementSet1);
  c=TestUtil.createConsumer(owner2);
  c.setCreated(twelveHoursAgo);
  Entitlement e2=TestUtil.createEntitlement(owner2,c,p2,null);
  Set<Entitlement> entitlementSet2=new HashSet<Entitlement>();
  entitlementSet2.add(e2);
  p2.setEntitlements(entitlementSet2);
  when(entitlementCurator.findByPoolAttribute(eq("String_Node_Str"),eq("String_Node_Str"))).thenReturn(Arrays.asList(new Entitlement[]{e1,e2}));
  new UnmappedGuestEntitlementCleanerJob(entitlementCurator,poolManager,subAdapter).execute(null);
  verify(poolManager).revokeEntitlement(subAdapter,e1);
}
Program: 49449
Project: 49449
Buggy source:
protected Boolean annotationPresent(Object obj,String propertyName,Class<? extends Annotation> clazz){
  try {
    String postFix=propertyName.substring(0,1).toUpperCase() + propertyName.substring(1);
    String methodName="String_Node_Str" + postFix;
    Method getter=null;
    try {
      getter=obj.getClass().getMethod(methodName);
    }
 catch (    NoSuchMethodException e) {
      methodName="String_Node_Str" + postFix;
      getter=obj.getClass().getMethod(methodName);
    }
    Annotation a=getter.getAnnotation(clazz);
    if (a != null) {
      return true;
    }
  }
 catch (  NoSuchMethodException e) {
    log.warn("String_Node_Str" + propertyName + "String_Node_Str");
    return false;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if the specified annotation has been applied to the given object's class, property or accessor (in that order).
 * @param obj The object to check for the annotation
 * @param property The name of the property to check
 * @param annotation The annotation for which to check
 * @return True if the annotation is present either on the class, the property or the property's accessor; false otherwise.
 */
protected boolean annotationPresent(Object obj,String property,Class<? extends Annotation> annotation){
  if (obj.getClass().getAnnotation(annotation) != null) {
    return true;
  }
  try {
    Field field=obj.getClass().getField(property);
    if (field.getAnnotation(annotation) != null) {
      return true;
    }
  }
 catch (  NoSuchFieldException e) {
  }
  String[] prefixes={"String_Node_Str","String_Node_Str"};
  property=property.substring(0,1).toUpperCase() + property.substring(1);
  for (  String prefix : prefixes) {
    try {
      Method method=obj.getClass().getMethod(prefix + property);
      if (method.getAnnotation(annotation) != null) {
        return true;
      }
    }
 catch (    NoSuchMethodException e) {
    }
  }
  return false;
}
Program: 49450
Project: 49450
Buggy source:
private void configureHateoasObjectMapper(ObjectMapper mapper,boolean indentJson){
  mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS,false);
  if (indentJson) {
    mapper.configure(SerializationFeature.INDENT_OUTPUT,true);
  }
  SimpleFilterProvider filterProvider=new SimpleFilterProvider();
  String[] filters={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String filterName : filters) {
    filterProvider=filterProvider.addFilter(filterName,new MultiFilter(new HateoasBeanPropertyFilter(),new DynamicPropertyFilter()));
  }
  filterProvider.setDefaultFilter(new DynamicPropertyFilter());
  filterProvider.setFailOnUnknownId(false);
  mapper.setFilters(filterProvider);
  AnnotationIntrospector primary=new JacksonAnnotationIntrospector();
  AnnotationIntrospector secondary=new JaxbAnnotationIntrospector(mapper.getTypeFactory());
  AnnotationIntrospector pair=new AnnotationIntrospectorPair(primary,secondary);
  mapper.setAnnotationIntrospector(pair);
}

Fixed version (ground truth):
private void configureHateoasObjectMapper(ObjectMapper mapper,boolean indentJson){
  mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS,false);
  if (indentJson) {
    mapper.configure(SerializationFeature.INDENT_OUTPUT,true);
  }
  SimpleFilterProvider filterProvider=new SimpleFilterProvider();
  String[] filters={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String filterName : filters) {
    filterProvider=filterProvider.addFilter(filterName,new MultiFilter(new HateoasBeanPropertyFilter(),new DynamicPropertyFilter()));
  }
  filterProvider.setDefaultFilter(new DynamicPropertyFilter());
  filterProvider.setFailOnUnknownId(false);
  mapper.setFilters(filterProvider);
  AnnotationIntrospector primary=new JacksonAnnotationIntrospector();
  AnnotationIntrospector secondary=new JaxbAnnotationIntrospector(mapper.getTypeFactory());
  AnnotationIntrospector pair=new AnnotationIntrospectorPair(primary,secondary);
  mapper.setAnnotationIntrospector(pair);
}
Program: 49451
Project: 49451
Buggy source:
@Inject public EventManager(Map<String,EventHandler> targetHandlers,EventCurator eventCurator){
  this.eventCurator=eventCurator;
  this.targetHandlers=targetHandlers;
}

Fixed version (ground truth):
@Inject public EventManager(Map<String,EventHandler> targetHandlers){
  this.targetHandlers=targetHandlers;
}
Program: 49452
Project: 49452
Buggy source:
/** 
 * Properly stores events by routing them to event handlers
 * @param event to store
 */
public void handle(Event event){
  EventHandler handler=targetHandlers.get(event.getTarget());
  if (handler != null) {
    log.info("String_Node_Str" + event + "String_Node_Str"+ handler.getClass().getSimpleName());
    String eventType=event.getType();
    if (MODIFIED_EVENT_TYPE.equals(eventType)) {
      event.setStatus(handler.handleUpdated(event));
    }
 else     if (CREATED_EVENT_TYPE.equals(eventType)) {
      event.setStatus(handler.handleCreated(event));
    }
 else     if (DELETED_EVENT_TYPE.equals(eventType)) {
      event.setStatus(handler.handleDeleted(event));
    }
 else {
      log.warn("String_Node_Str" + eventType);
      event.setStatus(Event.Status.SKIPPED);
    }
  }
 else {
    event.setStatus(Event.Status.SKIPPED);
  }
  eventCurator.merge(event);
}

Fixed version (ground truth):
/** 
 * Properly stores events by routing them to event handlers
 * @param event to store
 */
public void handle(Event event){
  EventHandler handler=targetHandlers.get(event.getTarget());
  if (handler != null) {
    log.info("String_Node_Str" + event + "String_Node_Str"+ handler.getClass().getSimpleName());
    String eventType=event.getType();
    if (MODIFIED_EVENT_TYPE.equals(eventType)) {
      event.setStatus(handler.handleUpdated(event));
    }
 else     if (CREATED_EVENT_TYPE.equals(eventType)) {
      event.setStatus(handler.handleCreated(event));
    }
 else     if (DELETED_EVENT_TYPE.equals(eventType)) {
      event.setStatus(handler.handleDeleted(event));
    }
 else {
      log.warn("String_Node_Str" + eventType);
      event.setStatus(Event.Status.SKIPPED);
    }
  }
 else {
    event.setStatus(Event.Status.SKIPPED);
  }
}