### Question:
SegmentFactory { public ConnectableSegment createSegment(Member member) { Way way = member.getWay(); if (RoundaboutService.isRoundabout(way)) return new RoundaboutWay(way.getNodes()); String memberRole = member.getRole(); if ("forward".equals(memberRole)) return createFixedSegment(way, false); else if ("backward".equals(memberRole)) return createFixedSegment(way, true); else return createFlexibleSegment(way); }  ConnectableSegment createSegment(Member member);  }### Answer:
@Test public void testCreateMember() throws Exception { assertEqualClass(FlexibleWay.class, segmentFactory.createSegment(new Member(TestUtils.asWay(1, 2, 3), "")) .getClass()); assertEqualClass(FlexibleWay.class, segmentFactory.createSegment(new Member(TestUtils.asWay(1, 2, 3), "inner")) .getClass()); assertEqualClass(FlexibleWay.class, segmentFactory.createSegment(new Member(TestUtils.asWay(1, 2, 3), "outer")) .getClass()); assertEqualClass(FixedWay.class, segmentFactory.createSegment(new Member(TestUtils.asWay(1, 2, 3), "forward")) .getClass()); assertEqualClass(FixedWay.class, segmentFactory.createSegment(new Member(TestUtils.asWay(1, 2, 3), "backward")) .getClass()); assertEqualClass(RoundaboutWay.class, segmentFactory.createSegment(new Member(TestUtils.asWay(10, 11, 12, 13, 10), "")).getClass()); assertEqualClass(RoundaboutWay.class, segmentFactory.createSegment(new Member(TestUtils.asWay(10, 11, 12, 13, 10), "forward")).getClass()); assertEqualClass(RoundaboutWay.class, segmentFactory.createSegment(new Member(TestUtils.asWay(10, 11, 12, 13, 10), "backward")).getClass()); }
@Test public void testCreateMemberUnknown() throws Exception { ConnectableSegment segment = segmentFactory.createSegment(new Member(TestUtils.asWay(1, 2, 3), "unknown")); assertTrue(segment instanceof FlexibleWay); }