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
Version of JMockit that was used: Update from Version 1.30 to Version 1.34
Description of the problem:
Since the update from JMockit version 1.30 to version 1.34 we're not able to mock any type of exception (standard JDK type neither custom created types) with JMockit's @mock annotation - bug or feature?
From eclipse JUnit tests stop to run cause an StackOverflowError claiming a NoClassDefFoundError/ ClassNotFoundException when an exception type field is annotated with @mocked annotation. From ANT execution crashes with an "JVM exited abnormally" error. @tested on the other hand works fine though.
When an exception type is mocked with @mocked annotation as method parameter the test just fails directly with the appropriate failure message: "java.lang.IllegalArgumentException: Class java.lang.Throwable is not mockable". Even though it's a standard JDK exception type or a custom one.
In JMockit version 1.32 the mocking of exception types worked fine, so I think the behaviour changed with the release of version 1.33 (which became extended features with the @tested annotation).
Regards
Sebsen
The text was updated successfully, but these errors were encountered:
Sebsen
changed the title
Cannot mock Exceptions/ Throwable with @Mock annotation
Cannot mock Exceptions/ Throwable with @Mocked annotation
Sep 14, 2017
Please provide the following information:
Version of JMockit that was used: Update from Version 1.30 to Version 1.34
Description of the problem:
Since the update from JMockit version 1.30 to version 1.34 we're not able to mock any type of exception (standard JDK type neither custom created types) with JMockit's @mock annotation - bug or feature?
From eclipse JUnit tests stop to run cause an StackOverflowError claiming a NoClassDefFoundError/ ClassNotFoundException when an exception type field is annotated with @mocked annotation. From ANT execution crashes with an "JVM exited abnormally" error. @tested on the other hand works fine though.
When an exception type is mocked with @mocked annotation as method parameter the test just fails directly with the appropriate failure message: "java.lang.IllegalArgumentException: Class java.lang.Throwable is not mockable". Even though it's a standard JDK exception type or a custom one.
In JMockit version 1.32 the mocking of exception types worked fine, so I think the behaviour changed with the release of version 1.33 (which became extended features with the @tested annotation).
Regards
Sebsen
The text was updated successfully, but these errors were encountered: