Fix ReflectionHelper.findMethod #204

Unit test
This commit is contained in:
Alexander Shustanov 2018-06-09 12:02:08 +04:00
parent 21ecd82ac2
commit 087aa7b646

View File

@ -18,6 +18,9 @@
package com.haulmont.bali.util;
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.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 {
private void parentPrivateMethod() {
}
}
public static class MyParamExt extends MyParam {
private void privateMethod() {
}
}
public static class MyObject {