добавлены методы поиска полей по аннотации
This commit is contained in:
@@ -86,6 +86,20 @@ public class ReflectionObjectTest {
|
||||
ReflectionMethod refSetter = refField.setter();
|
||||
assertNotNull(refSetter);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fieldsWithAnnotation() {
|
||||
ReflectionObject refObj = new ReflectionObject(new SomeObject());
|
||||
|
||||
List<ReflectionField> list = refObj.fieldsWithAnnotation(SomeAnnotation.class);
|
||||
assertEquals(1, list.size());
|
||||
|
||||
ReflectionField refField = list.get(0);
|
||||
assertEquals("someIntField", refField.name());
|
||||
|
||||
SomeAnnotation annotation = refField.annotation(SomeAnnotation.class);
|
||||
assertNotNull(annotation);
|
||||
}
|
||||
//endregion
|
||||
|
||||
//region Method tests
|
||||
|
||||
Reference in New Issue
Block a user