chcchangchc / powermock

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

add one method in PowerMock class #306

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
the method is:
public static synchronized <T> IExpectationSetters<T> expectNew(String 
fullyQualifiedName, Class<?>[] parameterTypes, Object... arguments)
            throws Exception 

reason:
When I want to mock some private inner class, I need to focus on the right 
constructor. Thank you.

Original issue reported on code.google.com by cndoublehero@gmail.com on 29 Dec 2010 at 10:54

GoogleCodeExporter commented 9 years ago
Not sure if it's such a good idea because you would have to implement one for 
local classes and anonymous inner classes as well. You can use 
Whitebox.getInnerClassType(..), Whitebox.getLocalClassType(..) or 
Whitebox.getAnonymousInnerClassType(..) to get an inner class and then pass 
them to the current expectNew method.

Original comment by johan.ha...@gmail.com on 6 Jan 2011 at 12:14