use of com.tngtech.archunit.lang.EvaluationResult in project ArchUnit by TNG.
the class HandlingAssertion method evaluate.
Result evaluate(EvaluationResult evaluationResult) {
Result result = new Result();
result.addAll(evaluateFieldAccesses(evaluationResult));
result.addAll(evaluateMethodCalls(evaluationResult));
result.addAll(evaluateConstructorCalls(evaluationResult));
result.addAll(evaluateCalls(evaluationResult));
result.addAll(evaluateAccesses(evaluationResult));
result.addAll(evaluateDependencies(evaluationResult));
return result;
}
use of com.tngtech.archunit.lang.EvaluationResult in project ArchUnit by TNG.
the class ClassesShouldTest method notBeInnerClasses.
@Test
@UseDataProvider("notBeInnerClasses_rules")
public void notBeInnerClasses(ArchRule rule, Class<?> satisfied, Class<?> violated) {
EvaluationResult result = rule.evaluate(importClasses(satisfied, violated));
assertThat(singleLineFailureReportOf(result)).contains("classes should not be inner classes").containsPattern(String.format("Class <%s> is an inner class", quote(violated.getName()))).doesNotMatch(String.format(".*%s.* inner class.*", quote(satisfied.getName())));
}
use of com.tngtech.archunit.lang.EvaluationResult in project ArchUnit by TNG.
the class ClassesShouldTest method notBeAnonymousClasses.
@Test
@UseDataProvider("notBeAnonymousClasses_rules")
public void notBeAnonymousClasses(ArchRule rule, Class<?> satisfied, Class<?> violated) {
EvaluationResult result = rule.evaluate(importClasses(satisfied, violated));
assertThat(singleLineFailureReportOf(result)).contains("classes should not be anonymous classes").containsPattern(String.format("Class <%s> is an anonymous class", quote(violated.getName()))).doesNotMatch(String.format(".*%s.* anonymous class.*", quote(satisfied.getName())));
}
use of com.tngtech.archunit.lang.EvaluationResult in project ArchUnit by TNG.
the class ClassesShouldTest method notBeClass.
@Test
@UseDataProvider("notBeClass_rules")
public void notBeClass(ArchRule rule, Class<?> satisfied, Class<?> violated) {
EvaluationResult result = rule.evaluate(importClasses(satisfied, violated));
assertThat(singleLineFailureReportOf(result)).contains("classes should not be " + violated.getName()).containsPattern(String.format("Class <%s> is %s in %s", quote(violated.getName()), quote(violated.getName()), locationPattern(violated))).doesNotMatch(String.format(".*%s.* is .*", quote(satisfied.getName())));
}
use of com.tngtech.archunit.lang.EvaluationResult in project ArchUnit by TNG.
the class ClassesShouldTest method callConstructorWhere.
@Test
@UseDataProvider("callConstructorWhere_rules")
public void callConstructorWhere(ArchRule rule) {
EvaluationResult result = rule.evaluate(importClasses(ClassWithConstructor.class, ClassCallingConstructor.class, ClassCallingWrongConstructor.class));
assertThat(singleLineFailureReportOf(result)).contains(String.format("classes should call constructor where target is %s", ClassWithConstructor.class.getSimpleName())).containsPattern(callConstructorRegex(ClassCallingWrongConstructor.class, ClassCallingConstructor.class, int.class, Date.class)).doesNotMatch(callConstructorRegex(ClassCallingConstructor.class, ClassWithConstructor.class, String.class));
}
Aggregations