DarkVoidZeratu
DarkVoidZeratu

Reputation: 35

Failed to import junit

My Build Path

Error in Eclipse

Is it a bug in Eclipse? I have tried to refresh the project, restart Eclipse and system. Confused.

Upvotes: 0

Views: 58

Answers (1)

Stephen C
Stephen C

Reputation: 719551

Is it a bug in Eclipse?

Nope. It is a bug in the project setup. It looks like the project's maven dependency for junit is incorrect.

You are using the wrong Junit JAR file for the test code you are trying to compile. The junit.framework.TestCase class is from Junit 3, but you are using the JAR file for Junit 4.7. In Junit 4.x the package names changed to org.junit, and the TestCase class was dropped.

Solutions:

  1. Find and use the JAR file for the last Junit 3.x release. (This might be what you need ...)
  2. Update your testcases to use a newer version of Junit. (Preferably Junit 5.x)

(At the time of writing, the latest release of Junit 4.x is 4.13.)

Upvotes: 1

Related Questions