### Question:
PropertyWriterUtils { @SuppressWarnings("unchecked") public static Optional<Node<View, Edge>> getDockSourceNode(final Node<? extends View, ?> node) { return node.getInEdges().stream() .filter(PropertyWriterUtils::isDockEdge) .map(Edge::getSourceNode) .map(n -> (Node<View, Edge>) n) .findFirst(); }  static BPMNEdge createBPMNEdge(BasePropertyWriter source,
                                          BasePropertyWriter target,
                                          Connection sourceConnection,
                                          ControlPoint[] mid,
                                          Connection targetConnection); @SuppressWarnings("unchecked") static Optional<Node<View, Edge>> getDockSourceNode(final Node<? extends View, ?> node); static Import toImport(WSDLImport wsdlImport);  }### Answer:
@Test public void testGetDockSourceNodeWhenDocked() { Node<? extends View, Edge> dockSourceNode = mock(Node.class); Node<? extends View, Edge> node = mockDockedNode(dockSourceNode); Optional<Node<View, Edge>> result = PropertyWriterUtils.getDockSourceNode(node); assertTrue(result.isPresent()); assertEquals(dockSourceNode, result.get()); }
@Test public void testGetDockSourceNodeWhenNotDocked() { Node<? extends View, Edge> node = mock(Node.class); List<Edge> edges = new ArrayList<>(); when(node.getInEdges()).thenReturn(edges); Optional<Node<View, Edge>> result = PropertyWriterUtils.getDockSourceNode(node); assertFalse(result.isPresent()); }