With JMockit 1.33, this unit test passes. With JMockit 1.34 and later, it fails with the following error:
Missing invocation to:
on mock instance: org.slf4j.$Impl_Logger@2690d8e4
This is reproducible 100% time on every version up to 1.38 (the latest at the time of this writing).
The issues fixed according to the 1.34 changelog don't seem to be relevant to this problem, but it does include this item:
Did some more investigating and found that this only seems to happen if slf4j-log4j12 is on the classpath. If you use do not have it (thus having SLF4J rely on the no-operation logger implementation) it passes.
Here is the Gradle dependency list I used for the code above:
Commenting out the second line causes MyClassTest to pass on JMockit 1.34 through 1.38, but of course results in this error because no logging library is loaded.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
I used an empty log4j.properties file when reproducing this error with slf4j-log4j12 loaded.