### Question:
FlexibleWay implements ConnectableSegment { @Override public void appendNodesBetween(Collection<Node> nodes, Node startNode, Node endNode) { int startNodeIndex = wayNodes.indexOf(startNode); int endNodeIndex = wayNodes.indexOf(endNode); if (startNodeIndex >= 0 && endNodeIndex >= 0) { if (startNodeIndex < endNodeIndex) { for (int x = startNodeIndex + 1; x < endNodeIndex + 1; x++) { nodes.add(wayNodes.get(x)); } } else { appendNodesBackwards(nodes, startNodeIndex, endNodeIndex); } } else { throw new AnalyzerException("Cannot find given node in current way nodes"); } } FlexibleWay(List<Node> nodes); @Override SegmentNodes getSegmentNodes(); @Override ConnectableNode getEndpointNodes(); @Override Set<Node> getCommonNode(ConnectableSegment otherSegment); @Override boolean canConnect(ConnectableSegment otherSegment); @Override void appendNodesBetween(Collection<Node> nodes, Node startNode, Node endNode); @Override boolean containsNodes(Node... nodes); @Override boolean canConnectNodesInDirection(Node startNode, Node endNode); @Override double getLength();  }### Answer:
@Test public void testAppendNodesBetween() throws Exception { assertNodesInOrder(flexibleWay, firstNode, lastNode, 2, 3, 4); assertNodesInOrder(flexibleWay, lastNode, firstNode, 3, 2, 1); }