List<Integer> expect = new ArrayList<Integer>();
for (int i : expectKeys) {
expect.add(i);
}
EntityJoin join = new EntityJoin(primary);
if (k1 >= 0) {
join.addCondition(sec1, k1);
}
if (k2 >= 0) {
join.addCondition(sec2, k2);
}
if (k3 >= 0) {
join.addCondition(sec3, k3);
}
List<Integer> found;
Transaction txn = txnBegin();
/* Keys */
found = new ArrayList<Integer>();
ForwardCursor<Integer> keys = join.keys(txn, null);
for (int i : keys) {
found.add(i);
}
keys.close();
assertEquals(expect, found);
/* Entities */
found = new ArrayList<Integer>();
ForwardCursor<MyEntity> entities = join.entities(txn, null);
for (MyEntity e : entities) {
found.add(e.id);
}
entities.close();
assertEquals(expect, found);