I'm writing Testcases using EasyMock. My use case is
I searched internet and found injecting mocks can be done using EasyMockRunner
. and private method call can be mocked using PowerMockRunner
. And compiler is not allowing to add 2 runners on same testclass. I'm not able to find any other way to do these 2 things.
Any suggestions on other ways to achieve them are most welcome and appreciated.
I achieved injecting mocks using Whitebox.setInternalState(spiedMockObject,"attribute_tobeinjected",mockedValueToinject);
and sideways I could call private methods using PowerMock without any hassles.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.