### Question:
RelationMemberService { public void initSegments(AnalyzerContext analyzerContext) { Relation relation = analyzerContext.getRelation(); List<ConnectableSegment> segments = createSegmentsOutOfRelationMembers(relation); analyzerContext.setSegments(segments); } @Autowired  RelationMemberService(SegmentFactory segmentFactory); void initSegments(AnalyzerContext analyzerContext); List<ConnectableSegment> createSegmentsOutOfRelationMembers(Relation relation);  }### Answer:
@Test public void testSplitRelationByRole() throws Exception { TestUtils.prepareRestTemplateForRelation(restTemplate, TestUtils.RELATION_37415); AnalyzerContext analyzerContext = analyzerContextService.createAnalyzerContext(TestUtils.RELATION_37415, false); relationMemberService.initSegments(analyzerContext); assertNotNull(analyzerContext.getSegments()); assertEquals(73, analyzerContext.getSegments().size()); }
@Test public void testSplitRelationByRoleEmpty() throws Exception { TestUtils.prepareRestTemplateForRelation(restTemplate, TestUtils.RELATION_12320_NECKARTAL_WEG); AnalyzerContext analyzerContext = analyzerContextService.createAnalyzerContext( TestUtils.RELATION_12320_NECKARTAL_WEG, false); relationMemberService.initSegments(analyzerContext); assertNotNull(analyzerContext.getSegments()); assertEquals(931, analyzerContext.getSegments().size()); assertEquals(926, countInstances(FlexibleWay.class, analyzerContext.getSegments())); assertEquals(5, countInstances(RoundaboutWay.class, analyzerContext.getSegments())); }