use of com.tngtech.archunit.core.domain.ThrowsDeclaration in project ArchUnit by TNG.
the class ClassFileImporterMembersTest method classes_know_which_method_throws_clauses_contain_their_type.
@Test
public void classes_know_which_method_throws_clauses_contain_their_type() {
JavaClasses classes = new ClassFileImporter().importClasses(ClassWithThrowingMethod.class, FirstCheckedException.class);
Set<ThrowsDeclaration<JavaMethod>> throwsDeclarations = classes.get(FirstCheckedException.class).getMethodThrowsDeclarationsWithTypeOfSelf();
assertThatType(getOnlyElement(throwsDeclarations).getDeclaringClass()).matches(ClassWithThrowingMethod.class);
assertThat(classes.get(FirstCheckedException.class).getConstructorsWithParameterTypeOfSelf()).isEmpty();
}
use of com.tngtech.archunit.core.domain.ThrowsDeclaration in project ArchUnit by TNG.
the class ClassFileImporterMembersTest method classes_know_which_constructor_throws_clauses_contain_their_type.
@Test
public void classes_know_which_constructor_throws_clauses_contain_their_type() {
JavaClasses classes = new ClassFileImporter().importClasses(ClassWithThrowingConstructor.class, FirstCheckedException.class);
Set<ThrowsDeclaration<JavaConstructor>> throwsDeclarations = classes.get(FirstCheckedException.class).getConstructorsWithThrowsDeclarationTypeOfSelf();
assertThatType(getOnlyElement(throwsDeclarations).getDeclaringClass()).matches(ClassWithThrowingConstructor.class);
assertThat(classes.get(FirstCheckedException.class).getMethodThrowsDeclarationsWithTypeOfSelf()).isEmpty();
}
Aggregations