jmockit / jmockit1

Advanced Java library for integration testing, mocking, faking, and code coverage
Other
458 stars 238 forks source link

@Injectable objects are null with junit 5.4.0 and above #720

Closed dlipofsky closed 2 years ago

dlipofsky commented 2 years ago

Tests that worked with jmockit 1.44 and junit 5.3.2 are broken with junit 5.4.0, because objects created with @Injectable are null, so we get an NPE.

The same tests also work with junit 4 run via any version of junit-vintage-engine.

It's not clear what "It's already fixed..." refers to on https://github.com/jmockit/jmockit1/issues/585 but I can confirm it is still broken with 5.4.2, 5.5.2, 5.6.3, 5.7.2, and 5.8.2.

rliesenfeld commented 2 years ago

I am currently using JUnit 5.8.2 (latest version) with JMockit 1.49, and seeing no problems (with over 2000 tests).

No example test that reproduces the failure is given, so I am closing it as I can't reproduce it.

dlipofsky commented 2 years ago

I was able to write a tiny test and confirm this was fixed in jmockit 1.47. Unfortunately the way that jmockit aggressively removes deprecated features makes it a daunting task to ever upgrade the jmockit version on a large code base.