Skip to content

Commit 61bf6ea

Browse files
committed
Update AbstractAnnotationProcessingTest.java
1 parent 4a3ca17 commit 61bf6ea

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

microsphere-annotation-processor/src/test/java/io/microsphere/annotation/processor/AbstractAnnotationProcessingTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
import java.util.Set;
4343
import java.util.function.Predicate;
4444

45+
import static io.microsphere.annotation.processor.util.ConstructorUtils.findDeclaredConstructor;
46+
import static io.microsphere.annotation.processor.util.FieldUtils.findField;
47+
import static io.microsphere.annotation.processor.util.MethodUtils.findMethod;
4548
import static io.microsphere.annotation.processor.util.TypeUtils.ofDeclaredType;
4649
import static java.util.Collections.emptyList;
4750
import static org.junit.jupiter.api.Assertions.assertSame;
@@ -169,6 +172,21 @@ protected TypeElement getTypeElement(Type type) {
169172
return TypeUtils.getTypeElement(processingEnv, type);
170173
}
171174

175+
protected VariableElement getField(Type type, String fieldName) {
176+
TypeElement typeElement = getTypeElement(type);
177+
return findField(typeElement, fieldName);
178+
}
179+
180+
protected ExecutableElement getMethod(Type type, String methodName, Type... parameterTypes) {
181+
TypeElement typeElement = getTypeElement(type);
182+
return findMethod(typeElement, methodName, parameterTypes);
183+
}
184+
185+
protected ExecutableElement getConstructor(Type type, Type... parameterTypes) {
186+
TypeElement typeElement = getTypeElement(type);
187+
return findDeclaredConstructor(typeElement, parameterTypes);
188+
}
189+
172190
protected Element[] getElements(Type... types) {
173191
return getTypeMirrors(types).stream().map(TypeUtils::ofTypeElement).toArray(Element[]::new);
174192
}

0 commit comments

Comments
 (0)