mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-04 12:17:41 +08:00
parent
21ecd82ac2
commit
087aa7b646
@ -18,6 +18,9 @@
|
|||||||
package com.haulmont.bali.util;
|
package com.haulmont.bali.util;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
@ -40,10 +43,26 @@ public class ReflectionHelperTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFindMethod() throws Exception {
|
||||||
|
Method method = ReflectionHelper.findMethod(MyParamExt.class, "parentPrivateMethod");
|
||||||
|
assertNotNull(method);
|
||||||
|
|
||||||
|
method = ReflectionHelper.findMethod(MyParamExt.class, "privateMethod");
|
||||||
|
assertNotNull(method);
|
||||||
|
|
||||||
|
method = ReflectionHelper.findMethod(MyParamExt.class, "noSuchMethod");
|
||||||
|
Assert.isNull(method, "Should be null");
|
||||||
|
}
|
||||||
|
|
||||||
public static class MyParam {
|
public static class MyParam {
|
||||||
|
private void parentPrivateMethod() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MyParamExt extends MyParam {
|
public static class MyParamExt extends MyParam {
|
||||||
|
private void privateMethod() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MyObject {
|
public static class MyObject {
|
||||||
|
Loading…
Reference in New Issue
Block a user