### Question:
FlexibleWay implements ConnectableSegment { @Override public Set<Node> getCommonNode(ConnectableSegment otherSegment) { Set<Node> commonNodes = getCommonNodesInternal(otherSegment); if (commonNodes.isEmpty()) throw new AnalyzerException("No common nodes"); return commonNodes; } 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 testGetCommonNode() throws Exception { assertCommonNode(4, 6, 4, 7); assertCommonNode(1, 1, 6, 7); assertCommonNode(4, 4, 6, 7); assertCommonNode(4, 5, 4, 7); assertCommonNode(3, 5, 3, 7); assertCommonNode(3, 3, 8, 7); }
@Test(expected = AnalyzerException.class) public void testGetCommonNodeFail() throws Exception { flexibleWay.getCommonNode(asFlexibleOrderWay(7, 8, 9)); }