void () { List<Segment> target = new ArrayList<>(Arrays.asList( range(0, 0), range(2, 2), range(4, 4), range(6, 6) )); List<Segment> source = Arrays.asList( range(1, 1), range(2, 2), range(2, 3) ); target = mergeSegmentLists(target, source); assertEquals(Arrays.asList( range(0, 0), range(1, 1), range(2, 2), range(2, 3), range(4, 4), range(6, 6) ), target); target = mergeSegmentLists(target, source); assertEquals(Arrays.asList( range(0, 0), range(1, 1), range(2, 2), range(2, 3), range(4, 4), range(6, 6) ), target); target = mergeSegmentLists(target, Arrays.asList( range(-1, -1), range(-1, -2), range(-2, -3) )); assertEquals(Arrays.asList( range(-1, -1), range(-1, -2), range(-2, -3), range(0, 0), range(1, 1), range(2, 2), range(2, 3), range(4, 4), range(6, 6) ), target); }