[Solved] Junit4 unit test error: Method ‘initializationError’ not found. Opening the test class.

Today, I tested a piece of code with JUnit and reported an error method initialization error not found:: the following problems occurred:

Double click this to display the following error:

Query the Internet and say it’s the JUnit version:

Then I won’t use JUnit, the liberty, and download the latest junit4_Replace the rack package of 12

The query on the Internet also said that there was a lack of shelf bags. The problem was solved as follows:

In addition to junit-4.12.jar, two dependent jar packages are also introduced: hamcrest-core-1.3.rc2.jar and hamcrest-library-1.3.rc2.jar

Here, the problems of all netizens have been solved, and everyone is happy. However, I found that my problem still didn’t exist, or the above error, until I found in a comment on a forum that my method needs to add public. Wipe

 

 

Now JUnit is back to normal. Although it still reports an error, it is a problem in the code

Solve the problem

Similar Posts: