### Question:
ParentTypesMatcher { public BiPredicate<Node<? extends View<?>, ? extends Edge>, Node<? extends View<?>, ? extends Edge>> matcher() { return this::match; } ParentTypesMatcher(final Supplier<DefinitionManager> definitionManagerSupplier,
                              final Function<Node, Element> parentSupplier,
                              final Class<?>[] types); BiPredicate<Node<? extends View<?>, ? extends Edge>, Node<? extends View<?>, ? extends Edge>> matcher();  }### Answer:
@Test @SuppressWarnings("unchecked") public void testMatchParentTypeAsParentNodeBean() { ParentTypesMatcher tested = new ParentTypesMatcher(() -> graphTestHandler.getDefinitionManager(), GraphUtils::getParent, new Class[]{TestingGraphInstances.ParentNodeBean.class}); assertTrue(tested.matcher().test(graph.startNode, graph.intermNode)); assertTrue(tested.matcher().test(graph.intermNode, graph.endNode)); assertTrue(tested.matcher().test(graph.startNode, graph.endNode)); assertTrue(tested.matcher().test(graph.endNode, graph.nodeA)); assertTrue(tested.matcher().test(graph.intermNode, graph.nodeA)); assertTrue(tested.matcher().test(graph.startNode, graph.nodeA)); }
@Test @SuppressWarnings("unchecked") public void testMatchParentTypeAsContainerNodeBean() { ParentTypesMatcher tested = new ParentTypesMatcher(() -> graphTestHandler.getDefinitionManager(), GraphUtils::getParent, new Class[]{TestingGraphInstances.ContainerNodeBean.class}); assertTrue(tested.matcher().test(graph.startNode, graph.intermNode)); assertTrue(tested.matcher().test(graph.intermNode, graph.endNode)); assertTrue(tested.matcher().test(graph.startNode, graph.endNode)); assertFalse(tested.matcher().test(graph.endNode, graph.nodeA)); assertFalse(tested.matcher().test(graph.intermNode, graph.nodeA)); assertFalse(tested.matcher().test(graph.startNode, graph.nodeA)); }
@Test @SuppressWarnings("unchecked") public void testMatchParentTypeAsContainerNodeBeanButChangeIntermNode() { graphTestHandler .removeChild(graph.containerNode, graph.intermNode) .setChild(graph.parentNode, graph.intermNode); ParentTypesMatcher tested = new ParentTypesMatcher(() -> graphTestHandler.getDefinitionManager(), GraphUtils::getParent, new Class[]{TestingGraphInstances.ContainerNodeBean.class}); assertFalse(tested.matcher().test(graph.startNode, graph.intermNode)); assertFalse(tested.matcher().test(graph.intermNode, graph.endNode)); assertTrue(tested.matcher().test(graph.startNode, graph.endNode)); assertFalse(tested.matcher().test(graph.endNode, graph.nodeA)); assertTrue(tested.matcher().test(graph.intermNode, graph.nodeA)); assertFalse(tested.matcher().test(graph.startNode, graph.nodeA)); }