public void shouldDifferentiateClashingRelationshipTypesWhenTargetTypeEnforcedOnFieldAndCollectionSharingSuperType() throws Exception {
Square redSquare = squares.save(new Square(RED));
Rectangle yellowRectangle = rectangles.save(new Rectangle(YELLOW));
Rectangle blueRectangle = rectangles.save(new Rectangle(BLUE));
Mondrian mondrian = new Mondrian("Composition with Yellow, Blue and Red");
mondrian.includes(redSquare);
mondrian.includes(yellowRectangle, blueRectangle);
mondrians.save(mondrian);
assertThat(getRelationshipNames(template, mondrian), is(equalTo(asSet("includes"))));
mondrian = mondrians.findOne(mondrian.getId());
assertThat(mondrian.getQuadrilaterals(), is(equalTo((Iterable) asSet(redSquare, yellowRectangle, blueRectangle))));
assertThat(mondrian.getSquare(), is(equalTo(redSquare)));
assertThat(mondrian.getRectangles(), is(equalTo(asSet(yellowRectangle, blueRectangle))));
}