0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

JUnit 4.xをEclipseで実行するとNullPointerException

Posted at

新しいEclipseで古いJUnit 4を起動するとNullPointerExceptionになる。新しい・古いは曖昧な表現だが、たとえば、この現象が発生する具体的なバージョンの例は以下の通り。

環境

  • jdk 1.8
  • Eclipse 2021-06(4.20.0)
  • Junit 4.3

現象

エラーログは以下の通り。

java.lang.NullPointerException
	at org.eclipse.jdt.internal.junit4.runner.SubForestFilter.shouldRun(SubForestFilter.java:84)
	at org.junit.internal.runners.TestClassMethodsRunner.filter(TestClassMethodsRunner.java:84)
	at org.junit.runner.manipulation.Filter.apply(Filter.java:47)
	at org.junit.internal.runners.TestClassRunner.filter(TestClassRunner.java:64)
	at org.junit.runner.manipulation.Filter.apply(Filter.java:47)
	at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:34)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createFilteredTest(JUnit4TestLoader.java:83)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:74)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:49)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:513)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)

対策

このエントリ執筆時点では4.x系の最新が4.13.2なのでそれに変更する。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?