Update extends Operation { public Update(Repository repository) { super(repository); } Update(Repository repository); void now(Propoid propoid);  }
@Test public void testFoo() throws Exception { Foo foo = repository.query(new Foo()).single(); repository.update(foo); assertEquals(1, repository.query(new Foo()).count()); assertEquals(0, repository.query(new Bar()).count()); }
@Test public void testFooWithBar() throws Exception { Foo foo = repository.query(new Foo()).single(); foo.barP.set(new Bar()); foo.barsP.set(Arrays.asList(new Bar(), new Bar())); repository.update(foo); assertEquals(1, repository.query(new Foo()).count()); assertEquals(3, repository.query(new Bar()).count()); foo.barP.set(new Bar()); foo.barsP.set(Arrays.asList(new Bar(), new Bar())); repository.update(foo); assertEquals(1, repository.query(new Foo()).count()); assertEquals(3, repository.query(new Bar()).count()); foo.barP.set(null); foo.barsP.set(Collections.<Bar>emptyList()); repository.update(foo); assertEquals(1, repository.query(new Foo()).count()); assertEquals(0, repository.query(new Bar()).count()); }