[JAVA] [JUnit] I suddenly got an initialization Error in the JUnit test that worked normally until the day before; background and solution memorandum

When I was doing unit tests with JUnit, I suddenly got an initializationError with a method that worked normally until the day before. The following is a memorandum of background and solution.

Occurrence event

When I run a JUnit test using Eclipse, some test methods get an initializationError. It was working normally until the day before. image.png

environment

--Java: Version 1.8.0 --Junit: Version 4.12.0

Background and investigation

To check if there are any omissions in the coverage of additional development content Revert to pre-development commit and test. After that, when I changed to the latest commit and performed the test, an initialization Error like the above capture occurred. ・ ・ Because the development deadline was just around the corner, my head went blank.

After investigating, it seems that it happens when the method with @Test is called in the test method. There is no such place this time.

Reference: [A story that I was addicted to when I got an Initialization Error in JUnit | Isn't it okay for an individual? A memorandum for resident freelance SE](https://freitech.xsrv.jp/hobby/2018/04/07/post-177 /)

Cause and solution

As a result of various checks, I found that initializationError occurs only in the newly added test method. That means ... I arrived at the cause safely.

The cause is ... Commit before development → You did not build / deploy after returning to the latest commit. </ b> It's a so-called ordinary mistake. .. After that, it was solved successfully by executing build and deploy.

Lesson

Don't forget to build and deploy if you change branches or reset commits.

Recommended Posts

[JUnit] I suddenly got an initialization Error in the JUnit test that worked normally until the day before; background and solution memorandum
I don't see an error in Rails bundle install ... the solution
In WSL2, when I did `docker-compose up`, I got an error saying that the sh file was not found.
When I think about the 402 error that suddenly appeared in the middle of the introduction of PAY.jp, there was an unexpected place
I got an "ActionView :: Template :: Error: Permission denied" error in the test of 3.3.1 of Rails tutorial 6th edition, so I solved it.