private < T > Method [ ] getMethodsToProxy ( MockCreationSettings < T > settings ) { Set < MethodSetEntry > abstractMethods = new HashSet <> ( ) ; Set < MethodSetEntry > nonAbstractMethods = new HashSet <> ( ) ; Class < ? > superClass = settings . getTypeToMock ( ) ; while ( superClass != null ) { for ( Method method : superClass . getDeclaredMethods ( ) ) { if ( Modifier . isAbstract ( method . getModifiers ( ) ) && ! nonAbstractMethods . contains ( new MethodSetEntry ( method ) ) ) { abstractMethods . add ( new MethodSetEntry ( method ) ) ; } else { nonAbstractMethods . add ( new MethodSetEntry ( method ) ) ; } } superClass = superClass . getSuperclass ( ) ; } for ( Class < ? > i : settings . getTypeToMock ( ) . getInterfaces ( ) ) { for ( Method method : i . getMethods ( ) ) { if ( ! nonAbstractMethods . contains ( new MethodSetEntry ( method ) ) ) { abstractMethods . add ( new MethodSetEntry ( method ) ) ; } } } for ( Class < ? > i : settings . getExtraInterfaces ( ) ) { for ( Method method : i . getMethods ( ) ) { if ( ! nonAbstractMethods . contains ( new MethodSetEntry ( method ) ) ) { abstractMethods . add ( new MethodSetEntry ( method ) ) ; } } } Method [ ] methodsToProxy = new Method [ abstractMethods . size ( ) ] ; int i = 0 ; for ( MethodSetEntry entry : abstractMethods ) { methodsToProxy [ i ++ ] = entry . originalMethod ; } return methodsToProxy ; }
Get methods to proxy .