Developing Java actions with unit tests

2
I have build a Java action which needs to be unit tested. My folder structure: - javasource -- modulename.actions --- JA_SomeAction.java -- modulename.proxies --- SomeProxy.java -- modulename.business --- Business.java --- BusinessTest.java <----- The test..... As you can see I am trying to test the business class. In my case the business class does not instantiate any dependencies, they all get passed through the constructor except for proxies. (The business should be able to create & commit proxy instances if needed.) In my test I mock all dependencies with mockito so I can control the test. Once the logic comes that has to instantiate a proxy the trouble begins. Proxies need context in order to work. In tests I do not have/ do not want context. Proxies are filled with Final and Static methods which can't be mocked by normal mocking libraries. I got around this problem by using PowerMock. This works and I am now able to test all my business only my test coverage no longer works and I am no longer able to execute the tests in the UnitTestModule. I expect this is caused by PowerMock as it needs a different runner... My question is, what is the best way to unit test your logic. By unit test I mean without using the runtime/ DB/ context/ etc.
asked
0 answers