How to run junit with a parameterized constructor

I need to run junit test from the command line, and one of the guys from the command created junit classes, as shown below:

public Test extends TestCore { String some; public Test(String some) { this.some = some; } //some test here } 

this work is from an eclipse, but not from the command line. The result of executing this type of file gave me an error, as shown below:

 Test class should have exactly one public zero-argument constructor. 

Can anybody help me?

Greets Yaroslav.

+4
source share
1 answer

Eclipse uses a different test student. Perhaps parameterized constructors are caused by the fact that TestCore is a parameterized test, for example. eg:

 @RunWith(Parameterized.class) public class TestCore { String someThatWillBeHidden; public TestCore(String some) { this.someThatWillBeHidden = some; } @Parameters public static List<Object[]> data() { Object[][] data = new Object[][] { {"Hello"}, {" "}, {"world"}}; return Arrays.asList(data); } //some test here } 

So which version of junit are you using?

+2
source

All Articles