Search in sources :

Example 6 with ConditionEvent

use of com.tngtech.archunit.lang.ConditionEvent in project ArchUnit by TNG.

the class NeverCondition method check.

@Override
public void check(T item, ConditionEvents events) {
    ConditionEvents subEvents = new ConditionEvents();
    condition.check(item, subEvents);
    for (ConditionEvent event : subEvents) {
        event.addInvertedTo(events);
    }
}
Also used : ConditionEvent(com.tngtech.archunit.lang.ConditionEvent) ConditionEvents(com.tngtech.archunit.lang.ConditionEvents)

Example 7 with ConditionEvent

use of com.tngtech.archunit.lang.ConditionEvent in project gradle by gradle.

the class ArchUnitFixtureTest method reports_invalid_generic_type_parameter_of_return_type.

@Test
public void reports_invalid_generic_type_parameter_of_return_type() {
    ConditionEvent event = checkThatHasOnlyAllowedTypes("invalidTypeParameterInReturnType");
    assertHasViolation(event, File.class);
}
Also used : ConditionEvent(com.tngtech.archunit.lang.ConditionEvent) Test(org.junit.jupiter.api.Test)

Example 8 with ConditionEvent

use of com.tngtech.archunit.lang.ConditionEvent in project gradle by gradle.

the class ArchUnitFixtureTest method reports_valid_methods.

@Test
public void reports_valid_methods() {
    ConditionEvent event = checkThatHasOnlyAllowedTypes("validMethod");
    assertNoViolation(event);
}
Also used : ConditionEvent(com.tngtech.archunit.lang.ConditionEvent) Test(org.junit.jupiter.api.Test)

Example 9 with ConditionEvent

use of com.tngtech.archunit.lang.ConditionEvent in project gradle by gradle.

the class ArchUnitFixtureTest method reports_invalid_generic_type_parameter_bound.

@Test
public void reports_invalid_generic_type_parameter_bound() {
    ConditionEvent event = checkThatHasOnlyAllowedTypes("invalidTypeParameterBoundType");
    assertHasViolation(event, File.class);
}
Also used : ConditionEvent(com.tngtech.archunit.lang.ConditionEvent) Test(org.junit.jupiter.api.Test)

Example 10 with ConditionEvent

use of com.tngtech.archunit.lang.ConditionEvent in project gradle by gradle.

the class ArchUnitFixtureTest method reports_invalid_return_types.

@Test
public void reports_invalid_return_types() {
    ConditionEvent event = checkThatHasOnlyAllowedTypes("invalidReturnType");
    assertHasViolation(event, File.class);
}
Also used : ConditionEvent(com.tngtech.archunit.lang.ConditionEvent) Test(org.junit.jupiter.api.Test)

Aggregations

ConditionEvent (com.tngtech.archunit.lang.ConditionEvent)12 Test (org.junit.jupiter.api.Test)8 ConditionEvents (com.tngtech.archunit.lang.ConditionEvents)4 JavaClass (com.tngtech.archunit.core.domain.JavaClass)2 JavaMethod (com.tngtech.archunit.core.domain.JavaMethod)2 HasAnnotations (com.tngtech.archunit.core.domain.properties.HasAnnotations)2 ArchCondition (com.tngtech.archunit.lang.ArchCondition)2 SimpleConditionEvent (com.tngtech.archunit.lang.SimpleConditionEvent)2 File (java.io.File)2 Optional (java.util.Optional)2 Ignore (org.junit.Ignore)2 Disabled (org.junit.jupiter.api.Disabled)2 Annotation (java.lang.annotation.Annotation)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1