0

добавлены методы поиска Getter и Setter для полей

This commit is contained in:
2020-04-17 18:16:32 +03:00
parent 094318904c
commit a16fed9785
4 changed files with 62 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ public class ReflectionObjectTest {
new ReflectionObject(strObj).getOriginalObject(Integer.class);
}
//region Field tests
@Test
public void fieldsList() {
final List<String> expectedList = Arrays.asList("finalizedField", "simpleField");
@@ -64,6 +65,30 @@ public class ReflectionObjectTest {
refObj.field("field_not_exists");
}
@Test
public void field_getter() {
ReflectionObject refObj = new ReflectionObject(new SomeObject());
ReflectionField refField = refObj.field("someIntField");
assertNotNull(refField);
ReflectionMethod refGetter = refField.getter();
assertNotNull(refGetter);
}
@Test
public void field_setter() {
ReflectionObject refObj = new ReflectionObject(new SomeObject());
ReflectionField refField = refObj.field("someIntField");
assertNotNull(refField);
ReflectionMethod refSetter = refField.setter();
assertNotNull(refSetter);
}
//endregion
//region Method tests
@Test
public void methodsList() {
final List<String> expectedList = Arrays.asList("getSimpleField", "setSimpleField");
@@ -105,4 +130,5 @@ public class ReflectionObjectTest {
ReflectionObject refObj = new ReflectionObject(new SomeObject());
refObj.method("not_exists_method");
}
//endregion
}