Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.5 CE
-
Component/s: Class Extension
-
Labels:None
-
Number of attachments :
Description
Versions Affected:
EasyMock Class Extension 2.3 and 2.4
Scenerio:
When using EasyMock ClassExtension to create a stub version of an exception type that is thrown during a test by a mock collaborator of the class under test, EasyMock itself generates a NPE, instead of throwing the stub exception from the mock collaborator.
Example:
See attached. Can be run as a TestNG or JUnit test case.
Current Workaround:
When setting up the stub exception, include the following behavior:
EasyMock.expect( exception.fillInStackTrace() ).andReturn( exception );
Possible Solution:
Check whether the Throwable returned by t.getThrowable() is itself a mock object. If so, skip the fillInStackTrace() call before rethrowing it.