gordonad / powermock

Automatically exported from code.google.com/p/powermock
0 stars 0 forks source link

WhiteBox.getMethod(..) should also return protected and package-private methods. #49

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If we have a class like this: 

public final class SomeHelper {

    private SomeHelper() {

    }

    static class MyPlugin extends MyCorePlugin {
        public MyPlugin() {
            setLogManager(new MockLogManager());
        }  
    }

    ...

}

and load the classes are loaded from our classloader the MockGateway
performs a check, suppressMethod.contains(Whitebox.getMethod(objectType,
methodName, sig)), for the MyPlugin invokation of the setLogManager method.
However if setLogManager is protected the Whitebox.getMethod(..) won't find
the method because it's neither public or private. We need to address this!!

Original issue reported on code.google.com by johan.ha...@gmail.com on 28 Oct 2008 at 3:25

GoogleCodeExporter commented 8 years ago
getMethod should probably traverse the class hierarchy and find the correct 
method
regardless of the method modifier.

Original comment by johan.ha...@gmail.com on 28 Oct 2008 at 3:26

GoogleCodeExporter commented 8 years ago
This is also very good if the class under test is wrapped in a proxy that we've 
not
created ourselves.

Original comment by johan.ha...@gmail.com on 28 Oct 2008 at 3:50

GoogleCodeExporter commented 8 years ago

Original comment by johan.ha...@gmail.com on 29 Oct 2008 at 7:08

GoogleCodeExporter commented 8 years ago
WhiteBox.getMethod(..) now also returns protected and package-private methods.

Original comment by johan.ha...@gmail.com on 29 Oct 2008 at 11:59