assertEquals(adam1, children.get(0));
assertEquals(adam2, children.get(1));
}
public void testRelatedManyOldInsertWay() {
RelatedManyParent god = new RelatedManyParent("god");
god.insert();
RelatedManyChild adam1 = new RelatedManyChild("adam1");
adam1.owner = god;
adam1.insert();
RelatedManyChild adam2 = new RelatedManyChild("adam2");
adam2.owner = god;
adam2.insert();
assertNotNull(god.id);
assertEquals(god.id, adam1.owner.id);
assertEquals(god.id, adam2.owner.id);
// tries to forcesync on god
god.children.asList().forceSync();
assertEquals(adam1, god.children.asList().get(0));
assertEquals(adam2, god.children.asList().get(1));
RelatedManyParent godbis = Model.getByKey(RelatedManyParent.class, god.id);
List<RelatedManyChild> children = godbis.children.asQuery().fetch();
assertEquals(god, godbis);
assertEquals(adam1, children.get(0));
assertEquals(adam2, children.get(1));