From 087aa7b6460aa6976d570a5d0a0cfd0fffcb0e9c Mon Sep 17 00:00:00 2001 From: Alexander Shustanov Date: Sat, 9 Jun 2018 12:02:08 +0400 Subject: [PATCH] Fix ReflectionHelper.findMethod #204 Unit test --- .../bali/util/ReflectionHelperTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/global/test/com/haulmont/bali/util/ReflectionHelperTest.java b/modules/global/test/com/haulmont/bali/util/ReflectionHelperTest.java index 863df42944..780b4db31b 100644 --- a/modules/global/test/com/haulmont/bali/util/ReflectionHelperTest.java +++ b/modules/global/test/com/haulmont/bali/util/ReflectionHelperTest.java @@ -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 {