jmockit / jmockit1

Advanced Java library for integration testing, mocking, faking, and code coverage
Other
458 stars 238 forks source link

Dynamically create mock instance. #741

Open scheruga opened 1 year ago

scheruga commented 1 year ago

Please provide the following information:

Since it is no longer possible to mock a super class directly, I would like to do it by useing new MockUp whith a generic implementation of Object $advice(Invocation inv)

I would like to return an instance of a newly created mocked object all the time. The type of the returned instance would be of ((Method)inv.getInvokedMember()).getReturnType()

Therefore I would need a possibility to create a Mocked instance dynamically. (Like requested at https://github.com/jmockit/jmockit1/issues/46)