ahmaddarawshi / powermock

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

Whitebox.invokeConstructor may not work as expected with overloaded constructors #194

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
public class TryThis{

protected TryThis{String name}{this(name,true,false);}
protected TryThis{String name,boolean val){ this(name,val,false);}
protected TryThis{String name,val1,val2){..}
.....
}

While testing..
I've a unittestlike :
@Test
public void testConstructor() throws Exception{
 Whitebox.invokeConstructor(TryThis.class,"constru");
}

When i try to run this junit test.. getting
org.powermock.reflect.exception
TooManyConstructorsFoundException:Could not determine which
constructor to execute.Please specify the paramter types by hand..

Original issue reported on code.google.com by johan.ha...@gmail.com on 4 Nov 2009 at 10:02

GoogleCodeExporter commented 9 years ago
We must implement something similar to getBestCandidateMethod in WhiteboxImpl 
but for ctors.

Original comment by johan.ha...@gmail.com on 22 Jul 2010 at 9:23