JUnit: NoClassDefFoundError: org/junit/runner/manipulation/Filter

后端 未结 3 1083
暗喜
暗喜 2021-02-05 08:50

When I try to run some unit tests, the following error is raised:

java.lang.NoClassDefFoundError: org/junit/runner/manipulation/Filter
    at java.lang.Class.for         


        
3条回答
  •  心在旅途
    2021-02-05 08:55

    In my case the error had the same stack trace, (ending with java.lang.Class.forName0(Native Method)) but the error message was different:

    java.lang.VerifyError: (class: org/junit/runner/manipulation/Alphanumeric, method: create signature: (Lorg/junit/runner/manipulation/Ordering$Context;)Lorg/junit/runner/manipulation/Ordering;) Wrong return type in function

    The cause turned out to be that I had upgraded JUnit from 4.11 to 4.13.1, because GitHub's "dependabot" suggested so, on some public project of mine, and even created merge requests ready for me to accept, and I thought "sure, why not, what could possibly go wrong?" Conclusion: don't trust GitHub's dependabot.

提交回复
热议问题