### Question:
ConnectorShape extends AbstractElementShape<W, ViewConnector<W>, Edge<ViewConnector<W>, Node>, D, V> implements EdgeShape<W, ViewConnector<W>, Edge<ViewConnector<W>, Node>, V>,
                   Lifecycle { @Override public void applyConnections(final Edge<ViewConnector<W>, Node> element, final ShapeView<?> source, final ShapeView<?> target, final MutationContext mutationContext) { final ViewConnector connectionContent = element.getContent(); final Connection sourceConnection = (Connection) connectionContent.getSourceConnection().orElse(null); final Connection targetConnection = (Connection) connectionContent.getTargetConnection().orElse(null); final IsConnector shapeView = (IsConnector) getShapeView(); shapeView.connect(source, sourceConnection, target, targetConnection); } ConnectorShape(final D shapeDef,
                          final V view,
                          final ShapeStateHandler shapeStateHelper); @Override void applyConnections(final Edge<ViewConnector<W>, Node> element,
                                 final ShapeView<?> source,
                                 final ShapeView<?> target,
                                 final MutationContext mutationContext); @Override void applyPosition(final Edge<ViewConnector<W>, Node> element,
                              final MutationContext mutationContext); @Override void applyState(final ShapeState shapeState);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testApplyConnections() { final Object def = mock(Object.class); final Edge<ViewConnector<Object>, Node> edge = new EdgeImpl<>("uuid1"); final ViewConnectorImpl<Object> content = new ViewConnectorImpl<>(def, BOUNDS); Connection sourceConnection = mock(Connection.class); Connection targetConnection = mock(Connection.class); content.setSourceConnection(sourceConnection); content.setTargetConnection(targetConnection); edge.setContent(content); final ShapeView<?> source = mock(ShapeView.class); final ShapeView<?> target = mock(ShapeView.class); tested.applyConnections(edge, source, target, MutationContext.STATIC); verify(((IsConnector) shapeView), times(1)).connect(eq(source), eq(sourceConnection), eq(target), eq(targetConnection)); }
@Test @SuppressWarnings("unchecked") public void testApplyConnectionsEvenNoSourceOrTarget() { final Object def = mock(Object.class); final Edge<ViewConnector<Object>, Node> edge = new EdgeImpl<>("uuid1"); final ViewConnectorImpl<Object> content = new ViewConnectorImpl<>(def, BOUNDS); Connection sourceConnection = mock(Connection.class); Connection targetConnection = mock(Connection.class); content.setSourceConnection(sourceConnection); content.setTargetConnection(targetConnection); edge.setContent(content); tested.applyConnections(edge, null, null, MutationContext.STATIC); verify(((IsConnector) shapeView), times(1)).connect(eq(null), eq(sourceConnection), eq(null), eq(targetConnection)); }