junitparameter exception method should have no parameter

前端 未结 6 791
陌清茗
陌清茗 2021-01-02 05:21

By using JUnitParameter for testing a methode I have an exception. My code is similar to lot of example on JUnitParameter:

    private Object parametersForTe         


        
6条回答
  •  爱一瞬间的悲伤
    2021-01-02 05:42

    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.

提交回复
热议问题