Search in sources :

Example 1 with FieldGetAccessCondition

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

the class FieldAccessConditionTest method FieldGetAccessCondition_only_satisfied_on_get_field.

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

Aggregations

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