@Test public void testTargetsDontExist() throws Exception { fact.register(HasEntities.class); HasEntities he = new HasEntities(); he.single = Ref.create(kNone1); he.multi.add(Ref.create(kNone1)); he.multi.add(Ref.create(kNone2)); HasEntities fetched = this.putClearGet(he); assert fetched.single.get() == null; assert fetched.multi.get(0).get() == null; assert fetched.multi.get(1).get() == null; }
@Test public void testTargetsExist() throws Exception { fact.register(HasEntities.class); HasEntities he = new HasEntities(); he.single = Ref.create(k1); he.multi.add(Ref.create(k1)); he.multi.add(Ref.create(k2)); HasEntities fetched = this.putClearGet(he); assert fetched.single.get().getId().equals(t1.getId()); assert fetched.single.get().getSomeString().equals(t1.getSomeString()); assert fetched.multi.get(0).get() == fetched.single.get(); assert fetched.multi.get(1).get().getId().equals(t2.getId()); assert fetched.multi.get(1).get().getSomeString().equals(t2.getSomeString()); }