}
@Test
public void testTwoRelationExistingCircular() {
DataSet source = new DataSet();
Relation r1 = new Relation(1, 1);
source.addPrimitive(r1);
Relation r2 = new Relation(2, 3);
source.addPrimitive(r2);
r1.addMember(new RelationMember("relation-2",r2));
r2.addMember(new RelationMember("relation-1",r1));
source.setSelected(r1,r2);
MergeSourceBuildingVisitor builder = new MergeSourceBuildingVisitor(source);
DataSet hull = builder.build();
assertNotNull(hull);
assertEquals(2, hull.getRelations().size());
r1 = (Relation)hull.getPrimitiveById(1, OsmPrimitiveType.RELATION);
assertNotNull(r1);
r2 = (Relation)hull.getPrimitiveById(2, OsmPrimitiveType.RELATION);
assertNotNull(r2);
assertEquals(1, r1.getMembersCount());
assertTrue(r1.getMembers().contains(new RelationMember("relation-2",r2)));
assertEquals(1, r2.getMembersCount());
assertTrue(r2.getMembers().contains(new RelationMember("relation-1",r1)));
}