@@ -63,6 +63,10 @@ class MethodUtilsTest extends AbstractLangTest {
6363 protected abstract static class AbstractGetMatchingMethod implements InterfaceGetMatchingMethod {
6464 public abstract void testMethod5 (Exception exception );
6565 }
66+ protected abstract static class AbstractGetMatchingMethod2 implements InterfaceGetMatchingMethod {
67+ @ Override
68+ public void testMethod6 () { }
69+ }
6670
6771 interface ChildInterface {
6872 }
@@ -112,6 +116,12 @@ public void testMethod5(final Exception exception) {
112116 }
113117 }
114118
119+ private static final class ConcreteGetMatchingMethod2 extends AbstractGetMatchingMethod2 { }
120+ private static final class ConcreteGetMatchingMethod22 extends AbstractGetMatchingMethod2 {
121+ @ Override
122+ public void testMethod6 () { }
123+ }
124+
115125 public static class GrandParentObject {
116126 }
117127 public static class InheritanceBean {
@@ -670,6 +680,17 @@ void testGetMatchingMethod() throws NoSuchMethodException {
670680
671681 assertNullPointerException (
672682 () -> MethodUtils .getMatchingMethod (null , "testMethod5" , RuntimeException .class ));
683+
684+ {
685+ final Method testMethod6 = MethodUtils .getMatchingMethod (ConcreteGetMatchingMethod2 .class , "testMethod6" );
686+ assertNotNull (testMethod6 );
687+ assertEquals (AbstractGetMatchingMethod2 .class , testMethod6 .getDeclaringClass ());
688+ }
689+ {
690+ final Method testMethod6 = MethodUtils .getMatchingMethod (ConcreteGetMatchingMethod22 .class , "testMethod6" );
691+ assertNotNull (testMethod6 );
692+ assertEquals (ConcreteGetMatchingMethod22 .class , testMethod6 .getDeclaringClass ());
693+ }
673694 }
674695
675696 @ Test
0 commit comments