добавлен тест на generic method
This commit is contained in:
@@ -139,6 +139,23 @@ public class ReflectionObjectTest {
|
||||
assertNotNull(refMethod);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void method_generic() {
|
||||
SomeGenericObject<String, Integer> someGenericObject = new SomeGenericObject<>();
|
||||
String key = "KEY!";
|
||||
int value = 3306;
|
||||
|
||||
ReflectionObject refObj = new ReflectionObject(someGenericObject);
|
||||
|
||||
ReflectionMethod refMethod = refObj.method("genericMethod", Object.class, Object.class);
|
||||
assertNotNull(refMethod);
|
||||
|
||||
refMethod.invoke(key, value);
|
||||
assertFalse(someGenericObject.map.isEmpty());
|
||||
assertTrue(someGenericObject.map.containsKey(key));
|
||||
assertEquals(value, (int) someGenericObject.map.get(key));
|
||||
}
|
||||
|
||||
@Test(expected = ReflectionException.class)
|
||||
public void method_notExists() {
|
||||
ReflectionObject refObj = new ReflectionObject(new SomeObject());
|
||||
|
||||
Reference in New Issue
Block a user