java - Query on Junit @parameters method's return type and the test class constructor argument type -


the junit parameterized test returns collection of object array test class constructor type can anything?

for example:-

//some class constructor public parametrization (string username, string password, int pincode){     this.username=username;     this.password=password;     this.pincode=pincode; }  @parameters public static collection<object[]> getdata(){     object[][] data = new object[2][3];       //row 1st     data [0][0] = "usernamea";     data [0][1] = "passa";     data [0][2] = new integer(111);    } 

as can see the parameters returned method getdata() of type object during runtime assigned arguments of constructor other subclass type of object string, integer e.t.c incompatible per java rules eg:- string type object can't assigned object type...

so junit framework type casts values returned object types suite constructor argument types string?

am missing here?

as suggested values being casted. casting done java reflection api, specifically: constructor.newinstance(object...).

if you're curious, above method invoked junit on line 186, here (junit v4.11 source).


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -