Program: 176392
Project: 176392
Buggy source:
@Test public void test() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
  Person p1=new Person();
  p1.setAge(98);
  p1.setPersonId("String_Node_Str");
  p1.setDay(Day.SATURDAY);
  em.persist(p1);
  em.clear();
  Person p2=new Person();
  p2.setAge(100);
  p2.setPersonId("String_Node_Str");
  p2.setDay(Day.SATURDAY);
  em.persist(p2);
  String query="String_Node_Str";
  PersistenceDelegator delegator=CoreTestUtilities.getDelegator(em);
  KunderaQueryParser queryParser;
  KunderaQuery kunderaQuery=parseQuery(query);
  CoreQuery queryObj=new CoreQuery(query,kunderaQuery,delegator);
  queryObj.setParameter("String_Node_Str","String_Node_Str");
  List<Person> results=queryObj.getResultList();
  Assert.assertEquals(1,results.size());
  Assert.assertNotNull(queryObj.getLuceneQueryFromJPAQuery());
  Assert.assertNotNull(queryObj.populateUsingLucene());
  final String deleteQuery="String_Node_Str";
  kunderaQuery=parseQuery(deleteQuery);
  queryObj=new CoreQuery(query,kunderaQuery,delegator);
  try {
    Assert.assertNull(queryObj.getParameter("String_Node_Str",String.class));
  }
 catch (  IllegalArgumentException iaex) {
    Assert.assertEquals("String_Node_Str",iaex.getMessage());
  }
  Assert.assertNotNull(queryObj.getParameter(1,String.class));
  Assert.assertNotNull(queryObj.getParameterValue(1));
  try {
    queryObj.getParameterValue(1);
  }
 catch (  IllegalStateException usex) {
    Assert.assertEquals("String_Node_Str" + 1,usex.getMessage());
  }
  queryObj.setParameter(1,"String_Node_Str");
  queryObj.executeUpdate();
  kunderaQuery=parseQuery(query);
  queryObj=new CoreQuery(query,kunderaQuery,delegator);
  try {
    queryObj.setParameter(CoreTestUtilities.getParameter(),"String_Node_Str");
    Assert.fail("String_Node_Str");
  }
 catch (  IllegalArgumentException iaex) {
    Assert.assertNotNull(iaex);
  }
  try {
    queryObj.setParameter(CoreTestUtilities.getParameter("String_Node_Str","String_Node_Str"),"String_Node_Str");
    Assert.fail("String_Node_Str");
  }
 catch (  IllegalArgumentException iaex) {
    Assert.assertNotNull(iaex);
  }
  queryObj.setParameter(queryObj.getParameter("String_Node_Str"),"String_Node_Str");
  results=queryObj.getResultList();
  Assert.assertEquals(0,results.size());
  queryObj.setHint("String_Node_Str","String_Node_Str");
  queryObj.setMaxResults(100);
  Assert.assertEquals(100,queryObj.getMaxResults());
  Assert.assertNotNull(queryObj.getHints());
  queryObj.setFetchSize(100);
  Assert.assertEquals(new Integer(100),queryObj.getFetchSize());
  query="String_Node_Str";
  queryObj.setParameter(queryObj.getParameter("String_Node_Str"),"String_Node_Str");
  results=queryObj.getResultList();
  Assert.assertEquals(0,results.size());
  Set luceneResults=queryObj.fetchByLuceneQuery();
  Assert.assertNotNull(luceneResults);
  Assert.assertEquals(1,luceneResults.size());
  Assert.assertNotNull(queryObj.getParameter("String_Node_Str",String.class));
  Assert.assertTrue(queryObj.isBound(queryObj.getParameter("String_Node_Str",String.class)));
  Assert.assertNotNull(queryObj.getParameterValue(queryObj.getParameter("String_Node_Str",String.class)));
  Assert.assertNotNull(queryObj.getParameterValue("String_Node_Str"));
  try {
    Assert.assertNull(queryObj.getParameter(1,String.class));
    Assert.fail("String_Node_Str");
  }
 catch (  IllegalArgumentException iaex) {
    Assert.assertNotNull(iaex);
  }
  try {
    queryObj.getParameter(1);
  }
 catch (  IllegalArgumentException iaex) {
    Assert.assertNotNull(iaex);
  }
  try {
    ApplicationMetadata appMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata();
    appMetadata.addQueryToCollection(query,query,true,null);
    queryObj=new CoreQuery(query,kunderaQuery,delegator);
    Assert.assertNull(queryObj.getParameter(1,String.class));
    Assert.fail("String_Node_Str");
  }
 catch (  IllegalStateException iaex) {
    Assert.assertEquals("String_Node_Str",iaex.getMessage());
  }
  try {
    queryObj.getParameterValue("String_Node_Str");
  }
 catch (  IllegalArgumentException usex) {
    Assert.assertEquals("String_Node_Str",usex.getMessage());
  }
}

Fixed version (ground truth):
@Test public void test() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
  Person p1=new Person();
  p1.setAge(98);
  p1.setPersonId("String_Node_Str");
  p1.setDay(Day.SATURDAY);
  em.persist(p1);
  em.clear();
  Person p2=new Person();
  p2.setAge(100);
  p2.setPersonId("String_Node_Str");
  p2.setDay(Day.SATURDAY);
  em.persist(p2);
  String query="String_Node_Str";
  PersistenceDelegator delegator=CoreTestUtilities.getDelegator(em);
  KunderaQueryParser queryParser;
  KunderaQuery kunderaQuery=parseQuery(query);
  CoreQuery queryObj=new CoreQuery(query,kunderaQuery,delegator);
  queryObj.setParameter("String_Node_Str","String_Node_Str");
  List<Person> results=queryObj.getResultList();
  Assert.assertEquals(1,results.size());
  Assert.assertNotNull(queryObj.getLuceneQueryFromJPAQuery());
  Assert.assertNotNull(queryObj.populateUsingLucene());
  final String deleteQuery="String_Node_Str";
  kunderaQuery=parseQuery(deleteQuery);
  queryObj=new CoreQuery(query,kunderaQuery,delegator);
  try {
    Assert.assertNull(queryObj.getParameter("String_Node_Str",String.class));
  }
 catch (  IllegalArgumentException iaex) {
    Assert.assertEquals("String_Node_Str",iaex.getMessage());
  }
  Assert.assertNotNull(queryObj.getParameter(1,String.class));
  Assert.assertNotNull(queryObj.getParameterValue(1));
  try {
    queryObj.getParameterValue(1);
  }
 catch (  IllegalStateException usex) {
    Assert.assertEquals("String_Node_Str" + 1,usex.getMessage());
  }
  queryObj.setParameter(1,"String_Node_Str");
  queryObj.executeUpdate();
  kunderaQuery=parseQuery(query);
  queryObj=new CoreQuery(query,kunderaQuery,delegator);
  try {
    queryObj.setParameter(CoreTestUtilities.getParameter(),"String_Node_Str");
    Assert.fail("String_Node_Str");
  }
 catch (  IllegalArgumentException iaex) {
    Assert.assertNotNull(iaex);
  }
  try {
    queryObj.setParameter(CoreTestUtilities.getParameter("String_Node_Str","String_Node_Str"),"String_Node_Str");
    Assert.fail("String_Node_Str");
  }
 catch (  IllegalArgumentException iaex) {
    Assert.assertNotNull(iaex);
  }
  queryObj.setParameter(queryObj.getParameter("String_Node_Str"),"String_Node_Str");
  results=queryObj.getResultList();
  Assert.assertEquals(0,results.size());
  queryObj.setHint("String_Node_Str","String_Node_Str");
  queryObj.setMaxResults(100);
  Assert.assertEquals(100,queryObj.getMaxResults());
  Assert.assertNotNull(queryObj.getHints());
  queryObj.setFetchSize(100);
  Assert.assertEquals(new Integer(100),queryObj.getFetchSize());
  query="String_Node_Str";
  queryObj.setParameter(queryObj.getParameter("String_Node_Str"),"String_Node_Str");
  results=queryObj.getResultList();
  Assert.assertEquals(0,results.size());
  Set luceneResults=queryObj.fetchByLuceneQuery();
  Assert.assertNotNull(luceneResults);
  Assert.assertEquals(1,luceneResults.size());
  Assert.assertNotNull(queryObj.getParameter("String_Node_Str",String.class));
  Assert.assertTrue(queryObj.isBound(queryObj.getParameter("String_Node_Str",String.class)));
  Assert.assertNotNull(queryObj.getParameterValue(queryObj.getParameter("String_Node_Str",String.class)));
  Assert.assertNotNull(queryObj.getParameterValue("String_Node_Str"));
  try {
    Assert.assertNull(queryObj.getParameter(1,String.class));
    Assert.fail("String_Node_Str");
  }
 catch (  IllegalArgumentException iaex) {
    Assert.assertNotNull(iaex);
  }
  try {
    queryObj.getParameter(1);
  }
 catch (  IllegalArgumentException iaex) {
    Assert.assertNotNull(iaex);
  }
  try {
    ApplicationMetadata appMetadata=KunderaMetadata.INSTANCE.getApplicationMetadata();
    appMetadata.addQueryToCollection(query,query,true,null);
    queryObj=new CoreQuery(query,kunderaQuery,delegator);
    Assert.assertNull(queryObj.getParameter(1,String.class));
    Assert.fail("String_Node_Str");
  }
 catch (  IllegalStateException iaex) {
    Assert.assertEquals("String_Node_Str",iaex.getMessage());
  }
  try {
    queryObj.getParameterValue("String_Node_Str");
  }
 catch (  IllegalArgumentException usex) {
    Assert.assertEquals("String_Node_Str",usex.getMessage());
  }
  onassertBi1MAssociation(delegator);
  onassertBiM1Association(delegator);
}