Program: 80479
Project: 80479
Buggy source:
@Test public void testDomainQuery_Traversals_01(){
  IDomainAccess da1;
  DomainQuery q;
  DomainQueryResult result=null;
  boolean equals;
  String testId;
  String qCypher;
  TestDataReader tdr=new TestDataReader("String_Node_Str");
  Population population=new Population();
  population.createPopulation();
  da1=DomainAccessFactory.createDomainAccess(dbAccess,domainName);
  testId="String_Node_Str";
  queriesStream.reset();
  q=da1.createQuery();
  DomainObjectMatch<Person> j_smith=q.createMatch(Person.class);
  q.WHERE(j_smith.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.WHERE(j_smith.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  DomainObjectMatch<Address> j_smith_Addresses=q.TRAVERSE_FROM(j_smith).FORTH("String_Node_Str").TO(Address.class);
  result=q.execute();
  List<Address> j_smith_AddressesResult=result.resultOf(j_smith_Addresses);
  equals=CompareUtil.equalsUnorderedList(population.getJohn_smith_addresses(),j_smith_AddressesResult);
  assertTrue(equals);
  qCypher=TestDataReader.trimComments(queriesStream.toString().trim());
  assertQuery(testId,qCypher,tdr.getTestData(testId));
  testId="String_Node_Str";
  queriesStream.reset();
  q=da1.createQuery();
  DomainObjectMatch<Subject> subs=q.createMatch(Subject.class);
  q.WHERE(subs.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.OR();
  q.BR_OPEN();
  q.WHERE(subs.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.WHERE(subs.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.BR_CLOSE();
  DomainObjectMatch<PointOfContact> subs_Contacts=q.TRAVERSE_FROM(subs).FORTH("String_Node_Str").TO(PointOfContact.class);
  DomainObjectMatch<Area> areas=q.TRAVERSE_FROM(subs_Contacts).FORTH("String_Node_Str").TO(Area.class);
  result=q.execute();
  List<Subject> subsResult=result.resultOf(subs);
  List<PointOfContact> subs_ContactsResult=result.resultOf(subs_Contacts);
  List<Area> areasResult=result.resultOf(areas);
  equals=CompareUtil.equalsUnorderedList(population.getJohn_smith_globcom(),subsResult);
  assertTrue(equals);
  equals=CompareUtil.equalsUnorderedList(population.getJohn_smith_globcom_contacts(),subs_ContactsResult);
  assertTrue(equals);
  equals=CompareUtil.equalsUnorderedList(population.getAreas_sf_vienna_01_munich(),areasResult);
  assertTrue(equals);
  qCypher=TestDataReader.trimComments(queriesStream.toString().trim());
  assertQuery(testId,qCypher,tdr.getTestData(testId));
  testId="String_Node_Str";
  queriesStream.reset();
  q=da1.createQuery();
  DomainObjectMatch<Subject> subs_1=q.createMatch(Subject.class);
  q.WHERE(subs_1.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.OR();
  q.BR_OPEN();
  q.WHERE(subs_1.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.WHERE(subs_1.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.BR_CLOSE();
  subs_1.setPage(1,1);
  DomainObjectMatch<PointOfContact> subs_1_Contacts=q.TRAVERSE_FROM(subs_1).FORTH("String_Node_Str").TO(PointOfContact.class);
  subs_1_Contacts.setPage(2,2);
  q.ORDER(subs_1_Contacts).BY("String_Node_Str");
  DomainObjectMatch<Area> areas_1=q.TRAVERSE_FROM(subs_1_Contacts).FORTH("String_Node_Str").TO(Area.class);
  areas_1.setPage(0,1);
  q.ORDER(areas_1).BY("String_Node_Str").DESCENDING();
  result=q.execute();
  List<Subject> subs_1Result=result.resultOf(subs_1);
  List<PointOfContact> subs_1_ContactsResult=result.resultOf(subs_1_Contacts);
  List<Area> areas_1Result=result.resultOf(areas_1);
  List<Object> subs_1Comp=population.getJohn_smith_globcom().subList(1,2);
  equals=CompareUtil.equalsList(subs_1Comp,subs_1Result);
  assertTrue(equals);
  List<Object> contactsComp=population.getJohn_smith_globcom_contacts().subList(2,4);
  equals=CompareUtil.equalsList(contactsComp,subs_1_ContactsResult);
  assertTrue(equals);
  List<Object> areas_1Comp=population.getAreas_sf_vienna_01_munich().subList(0,1);
  equals=CompareUtil.equalsList(areas_1Comp,areas_1Result);
  assertTrue(equals);
  qCypher=TestDataReader.trimComments(queriesStream.toString().trim());
  assertQuery(testId,qCypher,tdr.getTestData(testId));
  testId="String_Node_Str";
  queriesStream.reset();
  q=da1.createQuery();
  DomainObjectMatch<Person> j_smith_1=q.createMatch(Person.class);
  q.WHERE(j_smith_1.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.WHERE(j_smith_1.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  DomainObjectMatch<Area> j_smith_1_Areas2=q.TRAVERSE_FROM(j_smith_1).FORTH("String_Node_Str").FORTH("String_Node_Str").FORTH("String_Node_Str").DISTANCE(1,-1).TO(Area.class);
  result=q.execute();
  List<Area> j_smith_1_Areas2Result=result.resultOf(j_smith_1_Areas2);
  equals=CompareUtil.equalsUnorderedList(population.getAreas_calif_vienna_munich_up(),j_smith_1_Areas2Result);
  assertTrue(equals);
  qCypher=TestDataReader.trimComments(queriesStream.toString().trim());
  assertQuery(testId,qCypher,tdr.getTestData(testId));
  testId="String_Node_Str";
  queriesStream.reset();
  q=da1.createQuery();
  DomainObjectMatch<Subject> j_smith_comp=q.createMatch(Subject.class);
  q.WHERE(j_smith_comp.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.WHERE(j_smith_comp.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  DomainObjectMatch<PointOfContact> pocs=q.TRAVERSE_FROM(j_smith_comp).FORTH("String_Node_Str").TO(PointOfContact.class);
  q.WHERE(pocs.atttribute("String_Node_Str")).LIKE("String_Node_Str");
  result=q.execute();
  List<PointOfContact> pocsResult=result.resultOf(pocs);
  equals=CompareUtil.equalsObjects(population.getMarketStreet_20(),pocsResult.get(0));
  assertTrue(equals);
  qCypher=TestDataReader.trimComments(queriesStream.toString().trim());
  assertQuery(testId,qCypher,tdr.getTestData(testId));
  testId="String_Node_Str";
  queriesStream.reset();
  q=da1.createQuery();
  DomainObjectMatch<Subject> jer_smith_comp=q.createMatch(Subject.class);
  areas=q.createMatch(Area.class);
  q.WHERE(jer_smith_comp.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.OR();
  q.BR_OPEN();
  q.WHERE(jer_smith_comp.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.WHERE(jer_smith_comp.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.BR_CLOSE();
  areas_1=q.TRAVERSE_FROM(jer_smith_comp).FORTH("String_Node_Str").FORTH("String_Node_Str").TO(Area.class);
  DomainObjectMatch<Area> areas_2=q.TRAVERSE_FROM(areas_1).FORTH("String_Node_Str").DISTANCE(1,-1).TO(Area.class);
  q.BR_OPEN();
  q.WHERE(areas).IN(areas_1);
  q.OR();
  q.WHERE(areas).IN(areas_2);
  q.BR_CLOSE();
  q.WHERE(areas.atttribute("String_Node_Str")).EQUALS(AreaType.CITY);
  result=q.execute();
  CountQueryResult cResult=q.executeCount();
  areasResult=result.resultOf(areas);
  equals=CompareUtil.equalsUnorderedList(population.getAreas_sf_vienna_munich(),areasResult);
  assertTrue(equals);
  long areasCount=cResult.countOf(areas);
  assertEquals(3,areasCount);
  qCypher=TestDataReader.trimComments(queriesStream.toString().trim());
  assertQuery(testId,qCypher,tdr.getTestData(testId));
  testId="String_Node_Str";
  queriesStream.reset();
  q=da1.createQuery();
  DomainObjectMatch<Subject> smith_globcomMatch=q.createMatch(Subject.class);
  q.WHERE(smith_globcomMatch.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.OR();
  q.BR_OPEN();
  q.WHERE(smith_globcomMatch.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.WHERE(smith_globcomMatch.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.BR_CLOSE();
  DomainObjectMatch<Area> immediateAreasMatch=q.TRAVERSE_FROM(smith_globcomMatch).FORTH("String_Node_Str").FORTH("String_Node_Str").TO(Area.class);
  q.WHERE(immediateAreasMatch.atttribute("String_Node_Str")).EQUALS(AreaType.CITY);
  result=q.execute();
  List<Area> immediateAreas=result.resultOf(immediateAreasMatch);
  List<Area> sf=new ArrayList<Area>();
  sf.add(population.getSanFrancisco());
  sf.add(population.getMunich());
  equals=CompareUtil.equalsUnorderedList(sf,immediateAreas);
  assertTrue(equals);
  qCypher=TestDataReader.trimComments(queriesStream.toString().trim());
  assertQuery(testId,qCypher,tdr.getTestData(testId));
  return;
}

Fixed version (ground truth):
@Test public void testDomainQuery_Traversals_01(){
  IDomainAccess da1;
  DomainQuery q;
  DomainQueryResult result=null;
  boolean equals;
  String testId;
  String qCypher;
  TestDataReader tdr=new TestDataReader("String_Node_Str");
  Population population=new Population();
  population.createPopulation();
  da1=DomainAccessFactory.createDomainAccess(dbAccess,domainName);
  testId="String_Node_Str";
  queriesStream.reset();
  q=da1.createQuery();
  DomainObjectMatch<Person> j_smith=q.createMatch(Person.class);
  q.WHERE(j_smith.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.WHERE(j_smith.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  DomainObjectMatch<Address> j_smith_Addresses=q.TRAVERSE_FROM(j_smith).FORTH("String_Node_Str").TO(Address.class);
  result=q.execute();
  List<Address> j_smith_AddressesResult=result.resultOf(j_smith_Addresses);
  equals=CompareUtil.equalsUnorderedList(population.getJohn_smith_addresses(),j_smith_AddressesResult);
  assertTrue(equals);
  qCypher=TestDataReader.trimComments(queriesStream.toString().trim());
  assertQuery(testId,qCypher,tdr.getTestData(testId));
  testId="String_Node_Str";
  queriesStream.reset();
  q=da1.createQuery();
  DomainObjectMatch<Subject> subs=q.createMatch(Subject.class);
  q.WHERE(subs.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.OR();
  q.BR_OPEN();
  q.WHERE(subs.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.WHERE(subs.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.BR_CLOSE();
  DomainObjectMatch<PointOfContact> subs_Contacts=q.TRAVERSE_FROM(subs).FORTH("String_Node_Str").TO(PointOfContact.class);
  DomainObjectMatch<Area> areas=q.TRAVERSE_FROM(subs_Contacts).FORTH("String_Node_Str").TO(Area.class);
  result=q.execute();
  List<Subject> subsResult=result.resultOf(subs);
  List<PointOfContact> subs_ContactsResult=result.resultOf(subs_Contacts);
  List<Area> areasResult=result.resultOf(areas);
  equals=CompareUtil.equalsUnorderedList(population.getJohn_smith_globcom(),subsResult);
  assertTrue(equals);
  equals=CompareUtil.equalsUnorderedList(population.getJohn_smith_globcom_contacts(),subs_ContactsResult);
  assertTrue(equals);
  equals=CompareUtil.equalsUnorderedList(population.getAreas_sf_vienna_01_munich(),areasResult);
  assertTrue(equals);
  qCypher=TestDataReader.trimComments(queriesStream.toString().trim());
  assertQuery(testId,qCypher,tdr.getTestData(testId));
  testId="String_Node_Str";
  queriesStream.reset();
  q=da1.createQuery();
  DomainObjectMatch<Subject> subs_1=q.createMatch(Subject.class);
  q.WHERE(subs_1.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.OR();
  q.BR_OPEN();
  q.WHERE(subs_1.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.WHERE(subs_1.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.BR_CLOSE();
  subs_1.setPage(1,1);
  DomainObjectMatch<PointOfContact> subs_1_Contacts=q.TRAVERSE_FROM(subs_1).FORTH("String_Node_Str").TO(PointOfContact.class);
  subs_1_Contacts.setPage(2,2);
  q.ORDER(subs_1_Contacts).BY("String_Node_Str");
  DomainObjectMatch<Area> areas_1=q.TRAVERSE_FROM(subs_1_Contacts).FORTH("String_Node_Str").TO(Area.class);
  areas_1.setPage(0,1);
  q.ORDER(areas_1).BY("String_Node_Str").DESCENDING();
  result=q.execute();
  List<Subject> subs_1Result=result.resultOf(subs_1);
  List<PointOfContact> subs_1_ContactsResult=result.resultOf(subs_1_Contacts);
  List<Area> areas_1Result=result.resultOf(areas_1);
  List<Object> subs_1Comp=population.getJohn_smith_globcom().subList(1,2);
  equals=CompareUtil.equalsList(subs_1Comp,subs_1Result);
  assertTrue(equals);
  List<Object> contactsComp=population.getJohn_smith_globcom_contacts().subList(2,4);
  equals=CompareUtil.equalsList(contactsComp,subs_1_ContactsResult);
  assertTrue(equals);
  List<Object> areas_1Comp=population.getAreas_sf_vienna_01_munich().subList(0,1);
  equals=CompareUtil.equalsList(areas_1Comp,areas_1Result);
  assertTrue(equals);
  qCypher=TestDataReader.trimComments(queriesStream.toString().trim());
  assertQuery(testId,qCypher,tdr.getTestData(testId));
  testId="String_Node_Str";
  queriesStream.reset();
  q=da1.createQuery();
  DomainObjectMatch<Person> j_smith_1=q.createMatch(Person.class);
  q.WHERE(j_smith_1.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.WHERE(j_smith_1.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  DomainObjectMatch<Area> j_smith_1_Areas2=q.TRAVERSE_FROM(j_smith_1).FORTH("String_Node_Str").FORTH("String_Node_Str").FORTH("String_Node_Str").DISTANCE(1,-1).TO(Area.class);
  result=q.execute();
  List<Area> j_smith_1_Areas2Result=result.resultOf(j_smith_1_Areas2);
  equals=CompareUtil.equalsUnorderedList(population.getAreas_calif_vienna_munich_up(),j_smith_1_Areas2Result);
  assertTrue(equals);
  qCypher=TestDataReader.trimComments(queriesStream.toString().trim());
  assertQuery(testId,qCypher,tdr.getTestData(testId));
  testId="String_Node_Str";
  queriesStream.reset();
  q=da1.createQuery();
  DomainObjectMatch<Subject> j_smith_comp=q.createMatch(Subject.class);
  q.WHERE(j_smith_comp.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.WHERE(j_smith_comp.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  DomainObjectMatch<PointOfContact> pocs=q.TRAVERSE_FROM(j_smith_comp).FORTH("String_Node_Str").TO(PointOfContact.class);
  q.WHERE(pocs.atttribute("String_Node_Str")).LIKE("String_Node_Str");
  result=q.execute();
  List<PointOfContact> pocsResult=result.resultOf(pocs);
  equals=CompareUtil.equalsObjects(population.getMarketStreet_20(),pocsResult.get(0));
  assertTrue(equals);
  qCypher=TestDataReader.trimComments(queriesStream.toString().trim());
  assertQuery(testId,qCypher,tdr.getTestData(testId));
  testId="String_Node_Str";
  queriesStream.reset();
  q=da1.createQuery();
  DomainObjectMatch<Subject> jer_smith_comp=q.createMatch(Subject.class);
  areas=q.createMatch(Area.class);
  q.WHERE(jer_smith_comp.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.OR();
  q.BR_OPEN();
  q.WHERE(jer_smith_comp.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.WHERE(jer_smith_comp.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.BR_CLOSE();
  areas_1=q.TRAVERSE_FROM(jer_smith_comp).FORTH("String_Node_Str").FORTH("String_Node_Str").TO(Area.class);
  DomainObjectMatch<Area> areas_2=q.TRAVERSE_FROM(areas_1).FORTH("String_Node_Str").DISTANCE(1,-1).TO(Area.class);
  q.BR_OPEN();
  q.WHERE(areas).IN(areas_1);
  q.OR();
  q.WHERE(areas).IN(areas_2);
  q.BR_CLOSE();
  q.WHERE(areas.atttribute("String_Node_Str")).EQUALS(AreaType.CITY);
  result=q.execute();
  CountQueryResult cResult=q.executeCount();
  areasResult=result.resultOf(areas);
  equals=CompareUtil.equalsUnorderedList(population.getAreas_sf_vienna_munich(),areasResult);
  assertTrue(equals);
  long areasCount=cResult.countOf(areas);
  assertEquals(3,areasCount);
  qCypher=TestDataReader.trimComments(queriesStream.toString().trim());
  assertQuery(testId,qCypher,tdr.getTestData(testId));
  testId="String_Node_Str";
  queriesStream.reset();
  q=da1.createQuery();
  DomainObjectMatch<Subject> smith_globcomMatch=q.createMatch(Subject.class);
  q.WHERE(smith_globcomMatch.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.OR();
  q.BR_OPEN();
  q.WHERE(smith_globcomMatch.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.WHERE(smith_globcomMatch.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.BR_CLOSE();
  DomainObjectMatch<Area> immediateAreasMatch=q.TRAVERSE_FROM(smith_globcomMatch).FORTH("String_Node_Str").FORTH("String_Node_Str").TO(Area.class);
  q.WHERE(immediateAreasMatch.atttribute("String_Node_Str")).EQUALS(AreaType.CITY);
  result=q.execute();
  List<Area> immediateAreas=result.resultOf(immediateAreasMatch);
  List<Area> sf=new ArrayList<Area>();
  sf.add(population.getSanFrancisco());
  sf.add(population.getMunich());
  equals=CompareUtil.equalsUnorderedList(sf,immediateAreas);
  assertTrue(equals);
  qCypher=TestDataReader.trimComments(queriesStream.toString().trim());
  assertQuery(testId,qCypher,tdr.getTestData(testId));
  testId="String_Node_Str";
  queriesStream.reset();
  q=da1.createQuery();
  j_smith=q.createMatch(Person.class);
  q.WHERE(j_smith.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  q.WHERE(j_smith.atttribute("String_Node_Str")).EQUALS("String_Node_Str");
  DomainObjectMatch<AbstractArea> jsAreas=q.TRAVERSE_FROM(j_smith).FORTH("String_Node_Str").FORTH("String_Node_Str").FORTH("String_Node_Str").DISTANCE(0,-1).TO(AbstractArea.class);
  result=q.execute();
  List<AbstractArea> jsAreasResult=result.resultOf(jsAreas);
  Person js=population.getJohn_smith();
  List<AbstractArea> compAreas=new ArrayList<AbstractArea>();
  for (  PointOfContact poc : js.getPointsOfContact()) {
    if (poc instanceof Address) {
      AbstractArea ar=((Address)poc).getArea();
      ar=ar.getPartOf();
      while (ar != null) {
        if (!compAreas.contains(ar))         compAreas.add(ar);
        ar=ar.getPartOf();
      }
    }
    if (poc instanceof EContact) {
      AbstractArea ar=((EContact)poc).getArea();
      ar=ar.getPartOf();
      while (ar != null) {
        if (!compAreas.contains(ar))         compAreas.add(ar);
        ar=ar.getPartOf();
      }
    }
  }
  equals=CompareUtil.equalsUnorderedList(compAreas,jsAreasResult);
  assertTrue(equals);
  qCypher=TestDataReader.trimComments(queriesStream.toString().trim());
  assertQuery(testId,qCypher,tdr.getTestData(testId));
  return;
}