Search in sources :

Example 11 with Constraint

use of com.buschmais.jqassistant.core.rule.api.model.Constraint in project jqa-core-framework by buschmais.

the class TransactionalVisitorTest method ruleException.

@Test
void ruleException() throws RuleException {
    Constraint constraint = mock(Constraint.class);
    doThrow(new RuleException("Test")).when(delegate).visitConstraint(constraint, MAJOR);
    try {
        visitor.visitConstraint(constraint, MAJOR);
        fail("Expecting a " + RuleException.class);
    } catch (RuleException e) {
        verify(delegate).visitConstraint(constraint, MAJOR);
        verifyFailedTransaction();
    }
}
Also used : Constraint(com.buschmais.jqassistant.core.rule.api.model.Constraint) RuleException(com.buschmais.jqassistant.core.rule.api.model.RuleException) Test(org.junit.jupiter.api.Test)

Example 12 with Constraint

use of com.buschmais.jqassistant.core.rule.api.model.Constraint in project jqa-core-framework by buschmais.

the class TransactionalVisitorTest method visitConstraint.

@Test
void visitConstraint() throws RuleException {
    Constraint constraint = mock(Constraint.class);
    visitor.visitConstraint(constraint, MINOR);
    verify(delegate).visitConstraint(constraint, MINOR);
    verifySuccessfulTransaction();
}
Also used : Constraint(com.buschmais.jqassistant.core.rule.api.model.Constraint) Test(org.junit.jupiter.api.Test)

Aggregations

Constraint (com.buschmais.jqassistant.core.rule.api.model.Constraint)12 Test (org.junit.jupiter.api.Test)11 Result (com.buschmais.jqassistant.core.report.api.model.Result)4 Concept (com.buschmais.jqassistant.core.rule.api.model.Concept)3 StringContains.containsString (org.hamcrest.core.StringContains.containsString)3 RuleException (com.buschmais.jqassistant.core.rule.api.model.RuleException)2 CompositeObject (com.buschmais.xo.api.CompositeObject)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 CypherExecutable (com.buschmais.jqassistant.core.rule.api.model.CypherExecutable)1 Group (com.buschmais.jqassistant.core.rule.api.model.Group)1 Severity (com.buschmais.jqassistant.core.rule.api.model.Severity)1 PackageDescriptor (com.buschmais.jqassistant.plugin.java.api.model.PackageDescriptor)1 A (com.buschmais.jqassistant.plugin.java.test.set.rules.dependency.packages.a.A)1 XOException (com.buschmais.xo.api.XOException)1 ArrayList (java.util.ArrayList)1