Search in sources :

Example 1 with FieldSetAccessCondition

use of com.tngtech.archunit.lang.conditions.FieldAccessCondition.FieldSetAccessCondition in project ArchUnit by TNG.

the class FieldAccessConditionTest method FieldSetAccessCondition_only_satisfied_on_set_field.

@Test
public void FieldSetAccessCondition_only_satisfied_on_set_field() {
    JavaFieldAccess setAccess = accessFromCallerToTargetWithType(SET);
    FieldSetAccessCondition setFieldCondition = new FieldSetAccessCondition(target(name(setAccess.getTarget().getName())));
    assertSatisfiedWithMessage(setFieldCondition, setAccess, "sets");
    JavaFieldAccess getAccess = accessFromCallerToTargetWithType(GET);
    setFieldCondition = new FieldSetAccessCondition(target(name(getAccess.getTarget().getName())));
    assertViolatedWithMessage(setFieldCondition, getAccess, "gets");
}
Also used : JavaFieldAccess(com.tngtech.archunit.core.domain.JavaFieldAccess) FieldSetAccessCondition(com.tngtech.archunit.lang.conditions.FieldAccessCondition.FieldSetAccessCondition) Test(org.junit.Test)

Aggregations

JavaFieldAccess (com.tngtech.archunit.core.domain.JavaFieldAccess)1 FieldSetAccessCondition (com.tngtech.archunit.lang.conditions.FieldAccessCondition.FieldSetAccessCondition)1 Test (org.junit.Test)1