junitparameter exception method should have no parameter
I stumbled across this article while looking for an issue to a similar problem. I was getting an exception like this:
java.lang.Exception: Method x should have no parameters
It turns out I was using the wrong import for the @Test
annotation.
I originally used import org.junit.Test;
but what I needed to use was import org.junit.jupiter.api.Test;
Long story short, make sure you are checking your imports, sometimes the auto-generated ones aren't really what you want.
Add @RunWith(JUnitParamsRunner.class) annotation above class as
@RunWith(JUnitParamsRunner.class)
public class TestClass {
Also you need to import
import junitparams.JUnitParamsRunner;
You are using wrong import for @Parameters
- it should be junitparams.Parameters
, not org.junit.runners.Parameterized.Parameters