You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In FieldReader and ReflectionMemberAccessor, if an IllegalAccessException is thrown, it will be suppressed.
At the very least, Mockito should include the original exception. When testing a modular application, it is common to have packages encapsulated by default.
Stacktrace
In FieldReader, the IllegalAccessException is caught. The exception is re-thrown but the cause is lost.
Issue Summary
In FieldReader and ReflectionMemberAccessor, if an IllegalAccessException is thrown, it will be suppressed.
At the very least, Mockito should include the original exception. When testing a modular application, it is common to have packages encapsulated by default.
Stacktrace
In FieldReader, the IllegalAccessException is caught. The exception is re-thrown but the cause is lost.
mockito/src/main/java/org/mockito/internal/util/reflection/FieldReader.java
Lines 28 to 35 in ea000f7
Using a debugger, the IllegalAccessException can be observed: https://pastebin.com/GsnU29QV
Problematic Code
Use
module-info
in the project and don't open the package under test to mockito.Use the
MockitoExtension
for JUnit:Environment
Mockito-Junit-Jupiter 3.9.0
Zulu16.28+11-CA (build 16+36)
The text was updated successfully, but these errors were encountered: