### Question:
Link { public static void addMerge(RoadSegment fromRoad1, RoadSegment fromRoad2, RoadSegment toRoad) { assert fromRoad1.laneCount() + fromRoad2.laneCount() == toRoad.laneCount(); final int laneCount1 = fromRoad1.laneCount(); for (int i = 0; i < laneCount1; ++i) { addLanePair(i, fromRoad1, i, toRoad); } final int laneCount2 = fromRoad2.laneCount(); for (int i = 0; i < laneCount2; ++i) { addLanePair(i, fromRoad1, i + laneCount1, toRoad); } } private  Link(); static void addLanePair(int fromLane, RoadSegment fromRoadsegment, int toLane, RoadSegment toRoadSegment); static RoadSegment addJoin(RoadSegment sourceRoad, RoadSegment sinkRoad); static void addMerge(RoadSegment fromRoad1, RoadSegment fromRoad2, RoadSegment toRoad); static void addFork(RoadSegment fromRoad, RoadSegment toRoad1, RoadSegment toRoad2);  }### Answer:
@Test public final void testAddMerge() { final int laneCount = 2; final int exitLaneCount = 1; final RoadSegment r0 = new RoadSegment(300.0, laneCount + exitLaneCount); final RoadSegment r1 = new RoadSegment(400.0, laneCount); r0.setLaneType(Lanes.LANE3, Lanes.Type.EXIT); Link.addJoin(r0, r1); assertEquals(null, r0.sinkRoadSegment(Lanes.LANE3)); assertEquals(r1, r0.sinkRoadSegment(Lanes.LANE2)); assertEquals(r1, r0.sinkRoadSegment(Lanes.LANE1)); assertEquals(Lanes.NONE, r0.sinkLane(Lanes.LANE3)); assertEquals(Lanes.LANE2, r0.sinkLane(Lanes.LANE2)); assertEquals(Lanes.LANE1, r0.sinkLane(Lanes.LANE1)); assertEquals(r0, r1.sourceRoadSegment(Lanes.LANE1)); assertEquals(r0, r1.sourceRoadSegment(Lanes.LANE2)); assertEquals(Lanes.LANE1, r1.sourceLane(Lanes.LANE1)); assertEquals(Lanes.LANE2, r1.sourceLane(Lanes.LANE2)); }