}
@Test
public void testUpdateRef() throws Exception {
ContainsPic cp = new ContainsPic();
cp.name = "cp one";
Key<ContainsPic> cpKey = ds.save(cp);
Pic pic = new Pic();
pic.name = "fist";
Key<Pic> picKey = ds.save(pic);
//test with Key<Pic>
UpdateResults<ContainsPic> res = ds.updateFirst(
ds.find(ContainsPic.class, "name", cp.name),
ds.createUpdateOperations(ContainsPic.class).set("pic", pic));
assertEquals(1, res.getUpdatedCount());
//test reading the object.
ContainsPic cp2 = ds.find(ContainsPic.class).get();
assertNotNull(cp2);
assertEquals(cp2.name, cp.name);
assertNotNull(cp2.pic);
assertNotNull(cp2.pic.name);
assertEquals(cp2.pic.name, pic.name);
res = ds.updateFirst(
ds.find(ContainsPic.class, "name", cp.name),
ds.createUpdateOperations(ContainsPic.class).set("pic", picKey));
//test reading the object.
ContainsPic cp3 = ds.find(ContainsPic.class).get();
assertNotNull(cp3);
assertEquals(cp3.name, cp.name);
assertNotNull(cp3.pic);
assertNotNull(cp3.pic.name);
assertEquals(cp3.pic.name, pic.name);