Search in sources :

Example 1 with CodeUnitCallTarget

use of com.tngtech.archunit.core.domain.AccessTarget.CodeUnitCallTarget in project ArchUnit by TNG.

the class AccessTargetTest method single_throws_declaration_is_resolved.

@Test
public void single_throws_declaration_is_resolved() {
    CodeUnitCallTarget target = getTarget("withASingleThrowsDeclaration");
    assertDeclarations(target, FirstCheckedException.class);
}
Also used : CodeUnitCallTarget(com.tngtech.archunit.core.domain.AccessTarget.CodeUnitCallTarget) Test(org.junit.Test)

Example 2 with CodeUnitCallTarget

use of com.tngtech.archunit.core.domain.AccessTarget.CodeUnitCallTarget in project ArchUnit by TNG.

the class AccessTargetTest method throws_declarations_on_non_unique_call_Targets_match_Reflection_API.

@Test
public void throws_declarations_on_non_unique_call_Targets_match_Reflection_API() {
    CodeUnitCallTarget target = getTarget("diamondMethod");
    assertDeclarations(target, FirstCheckedException.class, SecondCheckedException.class, ThirdCheckedException.class);
}
Also used : CodeUnitCallTarget(com.tngtech.archunit.core.domain.AccessTarget.CodeUnitCallTarget) Test(org.junit.Test)

Example 3 with CodeUnitCallTarget

use of com.tngtech.archunit.core.domain.AccessTarget.CodeUnitCallTarget in project ArchUnit by TNG.

the class AccessTargetTest method no_throws_clause_is_resolved.

@Test
public void no_throws_clause_is_resolved() {
    CodeUnitCallTarget target = getTarget("withoutThrowsDeclaration");
    ThrowsClause<? extends CodeUnitCallTarget> throwsClause = target.getThrowsClause();
    assertThatThrowsClause(throwsClause).as("throws clause").isEmpty();
    assertThat(throwsClause.getTypes()).isEmpty();
    assertThat(throwsClause.getOwner()).isEqualTo(target);
    assertThatType(throwsClause.getDeclaringClass()).matches(Target.class);
}
Also used : CodeUnitCallTarget(com.tngtech.archunit.core.domain.AccessTarget.CodeUnitCallTarget) Test(org.junit.Test)

Example 4 with CodeUnitCallTarget

use of com.tngtech.archunit.core.domain.AccessTarget.CodeUnitCallTarget in project ArchUnit by TNG.

the class AccessTargetTest method multiple_throws_declarations_are_resolved.

@Test
public void multiple_throws_declarations_are_resolved() {
    CodeUnitCallTarget target = getTarget("withMultipleThrowsDeclarations");
    assertDeclarations(target, FirstCheckedException.class, SecondCheckedException.class);
}
Also used : CodeUnitCallTarget(com.tngtech.archunit.core.domain.AccessTarget.CodeUnitCallTarget) Test(org.junit.Test)

Aggregations

CodeUnitCallTarget (com.tngtech.archunit.core.domain.AccessTarget.CodeUnitCallTarget)4 Test (org.junit.Test)4