Insert extends Operation { public Insert(Repository repository) { super(repository); } Insert(Repository repository); void now(Propoid propoid);  }
@Test public void testFoo() throws Exception { Foo foo = new Foo(); repository.insert(foo); assertEquals(1, repository.query(new Foo()).count()); assertEquals(0, repository.query(new Bar()).count()); }
@Test public void testFooWithBars() throws Exception { Foo foo = new Foo(); foo.barP.set(new Bar()); foo.barsP.set(Arrays.asList(new Bar(), new Bar())); repository.insert(foo); assertEquals(1, repository.query(new Foo()).count()); assertEquals(3, repository.query(new Bar()).count()); }
@Test public void testFooEx() throws Exception { repository.insert(new Foo()); repository.insert(new FooEx()); assertEquals(2, repository.query(new Foo()).count()); }
@Test public void testFooWithExistingBar() throws Exception { repository.insert(new Bar()); Bar bar = repository.query(new Bar()).single(); Foo foo = new Foo(); foo.barP.set(bar); foo.barsP.set(Arrays.asList(bar)); repository.insert(foo); assertEquals(1, repository.query(new Foo()).count()); assertEquals(1, repository.query(new Bar()).count()); }