use of org.kie.workbench.common.stunner.core.rule.RuleViolations in project kie-wb-common by kiegroup.
the class ContainmentEvaluationHandlerTest method testEvaluateFailed.
@Test
public void testEvaluateFailed() {
final Set<String> candidateRoles = new HashSet<String>(1) {
{
add("role4");
}
};
when(context.getParentRoles()).thenReturn(PARENT_ROLES);
when(context.getCandidateRoles()).thenReturn(candidateRoles);
final RuleViolations violations = tested.evaluate(RULE, context);
assertNotNull(violations);
assertTrue(violations.violations(RuleViolation.Type.ERROR).iterator().hasNext());
}
use of org.kie.workbench.common.stunner.core.rule.RuleViolations in project kie-wb-common by kiegroup.
the class DockingEvaluationHandlerTest method testEvaluateSuccess.
@Test
public void testEvaluateSuccess() {
final Set<String> candidateRoles = new HashSet<String>(1) {
{
add("drole2");
}
};
when(context.getParentRoles()).thenReturn(PARENT_ROLES);
when(context.getCandidateRoles()).thenReturn(candidateRoles);
final RuleViolations violations = tested.evaluate(RULE, context);
assertNotNull(violations);
assertFalse(violations.violations(RuleViolation.Type.ERROR).iterator().hasNext());
}
use of org.kie.workbench.common.stunner.core.rule.RuleViolations in project kie-wb-common by kiegroup.
the class DockingEvaluationHandlerTest method testEvaluateFailed.
@Test
public void testEvaluateFailed() {
final Set<String> candidateRoles = new HashSet<String>(1) {
{
add("drole4");
}
};
when(context.getParentRoles()).thenReturn(PARENT_ROLES);
when(context.getCandidateRoles()).thenReturn(candidateRoles);
final RuleViolations violations = tested.evaluate(RULE, context);
assertNotNull(violations);
assertTrue(violations.violations(RuleViolation.Type.ERROR).iterator().hasNext());
}
use of org.kie.workbench.common.stunner.core.rule.RuleViolations in project kie-wb-common by kiegroup.
the class EdgeCardinalityEvaluationHandlerTest method testEvaluateInMinOneFailed.
@Test
public void testEvaluateInMinOneFailed() {
when(context.getCandidateCount()).thenReturn(1);
when(context.getDirection()).thenReturn(EdgeCardinalityContext.Direction.INCOMING);
when(context.getOperation()).thenReturn(Optional.of(CardinalityContext.Operation.DELETE));
RuleViolations violations = tested.evaluate(RULE_IN_MIN_1, context);
assertNotNull(violations);
assertTrue(violations.violations(RuleViolation.Type.WARNING).iterator().hasNext());
}
use of org.kie.workbench.common.stunner.core.rule.RuleViolations in project kie-wb-common by kiegroup.
the class EdgeCardinalityEvaluationHandlerTest method testEvaluateInMaxOneSucess.
@Test
public void testEvaluateInMaxOneSucess() {
when(context.getCandidateCount()).thenReturn(0);
when(context.getDirection()).thenReturn(EdgeCardinalityContext.Direction.INCOMING);
when(context.getOperation()).thenReturn(Optional.of(CardinalityContext.Operation.ADD));
RuleViolations violations = tested.evaluate(RULE_IN_MAX_1, context);
assertNotNull(violations);
assertFalse(violations.violations(RuleViolation.Type.ERROR).iterator().hasNext());
}
Aggregations