I ran into this problem because I accidentally put the damaged Java JUnit test source file in the location src/main/java/... instead of the correct src/test/java/...
My IDE Eclipse did not complain about the lack of imports and was happy to run tests from this file while it was in src/main/java/... - while Jenkins would interrupt the construction and therefore testing.
Moving the problem file to the right place, src/test/java/... , solved my problem.
source share