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
Hi, I have included a quick maven project to figure out a weird issues with jdk21.
This same exact test work with jdk 17 but fails with jdk 21.
I am unsure of what the problem is, is it an issues with Mockito or JDK 21 itself?
I am expecting InvocationTargetException when doing method reflection invokes, but when a mock is force to throw NullPointerException the JDK21 is throwing IllegalArgumentException?
This only happens with NullPointerException other exception works fine???
Concrete class throwing null pointer also have no issues.
Here is the quick snip of test code in project
`@Slf4j
public class Jdk21ReflectMockitoTest {
private RuntimeException error = new NullPointerException("Unit Test");
// private RuntimeException error = new IllegalStateException("Unit Test");
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I have included a quick maven project to figure out a weird issues with jdk21.
This same exact test work with jdk 17 but fails with jdk 21.
I am unsure of what the problem is, is it an issues with Mockito or JDK 21 itself?
I am expecting InvocationTargetException when doing method reflection invokes, but when a mock is force to throw NullPointerException the JDK21 is throwing IllegalArgumentException?
This only happens with NullPointerException other exception works fine???
Concrete class throwing null pointer also have no issues.
Here is the quick snip of test code in project
`@Slf4j
public class Jdk21ReflectMockitoTest {
private RuntimeException error = new NullPointerException("Unit Test");
// private RuntimeException error = new IllegalStateException("Unit Test");
}
`
MockitoJdk21Test.zip
Beta Was this translation helpful? Give feedback.
All reactions