@Test
public void saveParentWithChildrenThenDeleteOned() {
Parent parent = new Parent();
Child child1 = new Child();
child1.setParent(parent);
parent.getChildren().add(child1);
Child child2 = new Child();
child2.setParent(parent);
parent.getChildren().add(child2);
Child child3 = new Child();
child3.setParent(parent);
parent.getChildren().add(child3);
// Save parent with 3 children
parent = indexColumnTesterService.save(parent);
Parent savedParent = indexColumnTesterService.getParentById(parent.getId());
assertEquals("3 children added to parent and saved, but after re-loading number of chilren different",
3, savedParent.getChildren().size()
);
// Removing child at position 1 and saving again
savedParent.getChildren().remove(1);
savedParent = indexColumnTesterService.save(savedParent);
savedParent = indexColumnTesterService.getParentById(savedParent.getId());
assertEquals("2 children added to parent and saved, but after re-loading number of chilren different",
2, savedParent.getChildren().size()
);
}