Search in sources :

Example 76 with RuleViolations

use of org.kie.workbench.common.stunner.core.rule.RuleViolations in project kie-wb-common by kiegroup.

the class SingleConnectorPerTypeGraphRuleTest method checkMissingConnectionTargetNodeDoesNotTriggerCheck.

@Test
@SuppressWarnings("unchecked")
public void checkMissingConnectionTargetNodeDoesNotTriggerCheck() {
    final Node source = mock(Node.class);
    when(context.getSource()).thenReturn(Optional.of(source));
    when(context.getTarget()).thenReturn(Optional.empty());
    when(context.getConnector()).thenReturn(connector);
    final RuleViolations result = check.evaluate(rule, context);
    assertNotNull(result);
    assertFalse(result.violations().iterator().hasNext());
    verify(check, never()).isConnectionAlreadyFormed(any(Node.class), any(Node.class), any(Edge.class));
}
Also used : Node(org.kie.workbench.common.stunner.core.graph.Node) RuleViolations(org.kie.workbench.common.stunner.core.rule.RuleViolations) Edge(org.kie.workbench.common.stunner.core.graph.Edge) Test(org.junit.Test)

Aggregations

RuleViolations (org.kie.workbench.common.stunner.core.rule.RuleViolations)76 Test (org.junit.Test)68 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)20 DefaultRuleViolations (org.kie.workbench.common.stunner.core.rule.violations.DefaultRuleViolations)19 RuleSet (org.kie.workbench.common.stunner.core.rule.RuleSet)16 RuleEvaluationContext (org.kie.workbench.common.stunner.core.rule.RuleEvaluationContext)14 Edge (org.kie.workbench.common.stunner.core.graph.Edge)13 Graph (org.kie.workbench.common.stunner.core.graph.Graph)13 Node (org.kie.workbench.common.stunner.core.graph.Node)12 HashMap (java.util.HashMap)11 ContainmentRuleViolation (org.kie.workbench.common.stunner.core.rule.violations.ContainmentRuleViolation)11 HashSet (java.util.HashSet)8 List (java.util.List)7 Collection (java.util.Collection)3 AbstractGraphDefinitionTypesTest (org.kie.workbench.common.stunner.core.AbstractGraphDefinitionTypesTest)3 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)3 TreeTraverseCallback (org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeTraverseCallback)3 ArrayList (java.util.ArrayList)2 View (org.kie.workbench.common.stunner.core.graph.content.view.View)2 EdgeImpl (org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl)2