use of com.tngtech.archunit.core.domain.JavaParameter in project ArchUnit by TNG.
the class ClassFileImporterAnnotationsTest method imports_methods_with_multiple_parameters_with_annotations_but_unannotated_parameters_in_between.
@Test
public void imports_methods_with_multiple_parameters_with_annotations_but_unannotated_parameters_in_between() {
JavaMethod method = new ClassFileImporter().importPackagesOf(ClassWithMethodWithAnnotatedParameters.class).get(ClassWithMethodWithAnnotatedParameters.class).getMethod(ClassWithMethodWithAnnotatedParameters.methodWithAnnotatedParametersGap, String.class, int.class, Object.class, List.class);
List<Set<JavaAnnotation<JavaParameter>>> parameterAnnotations = method.getParameterAnnotations();
assertThatAnnotations(parameterAnnotations.get(0)).isNotEmpty();
assertThatAnnotations(parameterAnnotations.get(1)).isEmpty();
assertThatAnnotations(parameterAnnotations.get(2)).isEmpty();
assertThatAnnotations(parameterAnnotations.get(3)).isNotEmpty();
List<JavaParameter> parameters = method.getParameters();
for (int i = 0; i < 4; i++) {
assertThat(parameterAnnotations.get(i)).isEqualTo(parameters.get(i).getAnnotations());
assertThatAnnotations(parameterAnnotations.get(i)).match(ImmutableSet.copyOf(method.reflect().getParameterAnnotations()[i]));
}
}
Aggregations