gordonad / powermock

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

Whitebox.getMethod doesn't Arrays.toString argument types #146

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a static method:
public class Utils {
    public static String foo(ComplexObject bar) {
        return "";
    }
}

2. Call Whitebox.getMethod with wrong arguments for this static method.
Whitebox.getMethod(Utils.class, "foo", String.class);

3. Whitebox will fail to find the method and throw an Exception message 
like:
org.powermock.reflect.exceptions.MethodNotFoundException: No method found 
with name 'foo' with argument types: [ [Ljava.lang.Class; ] in class Utils

What is the expected output? What do you see instead?
The error message should have the class names as a list instead of just the 
toString of the vararg argument types. For example should be more along the 
lines of:

org.powermock.reflect.exceptions.MethodNotFoundException: No method fund 
with name 'foo' with argument types: [ String ] in class Utils

What version of the product are you using? On what operating system?
1.2.5

Please provide any additional information below.

Original issue reported on code.google.com by cemca...@gmail.com on 3 Sep 2009 at 9:45

GoogleCodeExporter commented 9 years ago
Could probably have a lower priority than Medium...

Original comment by cemca...@gmail.com on 3 Sep 2009 at 9:45

GoogleCodeExporter commented 9 years ago
I _think_ this is fixed in the trunk already actually.

Original comment by johan.ha...@gmail.com on 4 Sep 2009 at 6:09

GoogleCodeExporter commented 9 years ago
Trunk version still has (WhiteboxImpl line 175):
throwExceptionIfMethodWasNotFound(type, methodName, null, new Object[] { 
parameterTypes 
});

I guess parameterTypes doesn't need to be wrapped in another array as the 
method 
expects one level of arrays. It should be:
throwExceptionIfMethodWasNotFound(type, methodName, null, parameterTypes);

Original comment by cemca...@gmail.com on 4 Sep 2009 at 6:42

GoogleCodeExporter commented 9 years ago
It wasn't fixed. I think I've fixed it now in trunk though. Could you please 
give it
a new try?

Original comment by johan.ha...@gmail.com on 4 Sep 2009 at 8:47

GoogleCodeExporter commented 9 years ago
Considered fixed

Original comment by johan.ha...@gmail.com on 7 Sep 2009 at 3:14