Program: 38653
Project: 38653
Buggy source:
@Test public void testKeyConstraint() throws Exception {
  long s1=createSubScope(Optional.empty(),Optional.of("String_Node_Str"));
  long s2=createSubScope(Optional.empty(),Optional.of("String_Node_Str"));
  long s3=createSubScope(Optional.empty(),Optional.of("String_Node_Str"));
  long s4=createSubScope(Optional.empty(),Optional.of("String_Node_Str"));
  transactor.executeAsTransaction(db -> {
    jackStore2.record(s1).update().put("String_Node_Str",15).put("String_Node_Str",50).execute(db);
    jackStore2.record(s2).update().put("String_Node_Str",20).put("String_Node_Str",60).execute(db);
    jackStore2.record(s3).update().put("String_Node_Str",25).put("String_Node_Str",70).execute(db);
    jackStore2.record(s4).update().put("String_Node_Str",30).put("String_Node_Str",80).execute(db);
  }
);
  jsRecords=transactor.query(db -> jackStore2.rootRecord().querySubRecords().whereSubRecord("String_Node_Str",JackMatchers.equalTo("String_Node_Str")).execute(db));
  assertEquals(Lists.newArrayList(s1),jsRecords.getRecordIds());
  jsRecords=transactor.query(db -> jackStore2.rootRecord().querySubRecords().whereSubRecord("String_Node_Str",JackMatchers.notEqualTo("String_Node_Str")).execute(db));
  assertEquals(Lists.newArrayList(s2,s3,s4),jsRecords.getRecordIds());
  jsRecords=transactor.query(db -> jackStore2.rootRecord().querySubRecords().whereSubRecord("String_Node_Str",JackMatchers.between("String_Node_Str","String_Node_Str")).execute(db));
  assertEquals(Lists.newArrayList(s1,s2,s3),jsRecords.getRecordIds());
  jsRecords=transactor.query(db -> jackStore2.rootRecord().querySubRecords().whereSubRecord("String_Node_Str",JackMatchers.greaterThan("String_Node_Str")).whereSubRecord("String_Node_Str",JackMatchers.lessThan("String_Node_Str")).execute(db));
  assertEquals(Lists.newArrayList(s2),jsRecords.getRecordIds());
  jsRecords=transactor.query(db -> jackStore2.rootRecord().querySubRecords().whereSubRecord("String_Node_Str",JackMatchers.equalTo("String_Node_Str")).whereSubRecord("String_Node_Str",JackMatchers.equalTo("String_Node_Str")).execute(db));
  assertEquals(Lists.newArrayList(s1),jsRecords.getRecordIds());
  jsRecords=transactor.query(db -> jackStore2.rootRecord().querySubRecords().whereSubRecord("String_Node_Str",JackMatchers.equalTo("String_Node_Str")).whereSubRecord("String_Node_Str",JackMatchers.notEqualTo("String_Node_Str")).execute(db));
  assertEquals(0,jsRecords.size());
  jsRecords=transactor.query(db -> jackStore2.rootRecord().querySubRecords().whereSubRecord("String_Node_Str",JackMatchers.greaterThan("String_Node_Str")).whereSubRecord("String_Node_Str",JackMatchers.lessThan("String_Node_Str")).execute(db));
  assertEquals(Lists.newArrayList(s2,s3),jsRecords.getRecordIds());
}

Fixed version (ground truth):
@Test public void testKeyConstraint() throws Exception {
  long s1=createSubScope(Optional.empty(),Optional.of("String_Node_Str"));
  long s2=createSubScope(Optional.empty(),Optional.of("String_Node_Str"));
  long s3=createSubScope(Optional.empty(),Optional.of("String_Node_Str"));
  long s4=createSubScope(Optional.empty(),Optional.of("String_Node_Str"));
  long s11=createSubScope(Optional.of(s1),Optional.of("String_Node_Str"));
  long s21=createSubScope(Optional.of(s2),Optional.of("String_Node_Str"));
  long s31=createSubScope(Optional.of(s3),Optional.of("String_Node_Str"));
  long s41=createSubScope(Optional.of(s4),Optional.of("String_Node_Str"));
  transactor.executeAsTransaction(db -> {
    jackStore2.record(s1).update().put("String_Node_Str",15).put("String_Node_Str",50).exec(db);
    jackStore2.record(s2).update().put("String_Node_Str",20).put("String_Node_Str",60).exec(db);
    jackStore2.record(s3).update().put("String_Node_Str",25).put("String_Node_Str",70).exec(db);
    jackStore2.record(s4).update().put("String_Node_Str",30).put("String_Node_Str",80).exec(db);
    jackStore2.record(s11).update().put("String_Node_Str",15).put("String_Node_Str",50).exec(db);
    jackStore2.record(s21).update().put("String_Node_Str",20).put("String_Node_Str",60).exec(db);
    jackStore2.record(s31).update().put("String_Node_Str",25).put("String_Node_Str",70).exec(db);
    jackStore2.record(s41).update().put("String_Node_Str",30).put("String_Node_Str",80).exec(db);
  }
);
  jsRecords=transactor.query(db -> jackStore2.rootRecord().querySubRecords().whereSubRecord("String_Node_Str",JackMatchers.equalTo("String_Node_Str")).execute(db));
  assertEquals(Lists.newArrayList(s1),jsRecords.getRecordIds());
  jsRecords=transactor.query(db -> jackStore2.rootRecord().querySubRecords().whereSubRecord("String_Node_Str",JackMatchers.notEqualTo("String_Node_Str")).execute(db));
  assertEquals(Lists.newArrayList(s2,s3,s4),jsRecords.getRecordIds());
  jsRecords=transactor.query(db -> jackStore2.rootRecord().querySubRecords().whereSubRecord("String_Node_Str",JackMatchers.between("String_Node_Str","String_Node_Str")).execute(db));
  assertEquals(Lists.newArrayList(s1,s2,s3),jsRecords.getRecordIds());
  jsRecords=transactor.query(db -> jackStore2.rootRecord().querySubRecords().whereSubRecord("String_Node_Str",JackMatchers.greaterThan("String_Node_Str")).whereSubRecord("String_Node_Str",JackMatchers.lessThan("String_Node_Str")).execute(db));
  assertEquals(Lists.newArrayList(s2),jsRecords.getRecordIds());
  jsRecords=transactor.query(db -> jackStore2.rootRecord().querySubRecords().whereSubRecord("String_Node_Str",JackMatchers.equalTo("String_Node_Str")).whereSubRecord("String_Node_Str",JackMatchers.equalTo("String_Node_Str")).execute(db));
  assertEquals(Lists.newArrayList(s1),jsRecords.getRecordIds());
  jsRecords=transactor.query(db -> jackStore2.rootRecord().querySubRecords().whereSubRecord("String_Node_Str",JackMatchers.equalTo("String_Node_Str")).whereSubRecord("String_Node_Str",JackMatchers.notEqualTo("String_Node_Str")).execute(db));
  assertEquals(0,jsRecords.size());
  jsRecords=transactor.query(db -> jackStore2.rootRecord().querySubRecords().whereSubRecord("String_Node_Str",JackMatchers.greaterThan("String_Node_Str")).whereSubRecord("String_Node_Str",JackMatchers.lessThan("String_Node_Str")).execute(db));
  assertEquals(Lists.newArrayList(s2,s3),jsRecords.getRecordIds());
}