It would be possible to setup expectations to construction of new objects
like this:
expect(new File("mypath")).andReturn(fileMock);
This would work if the MockGateway does something like this on each
constructor call:
Class stateKlass =
Class.forName("powermock.extension.spi.PowerMockStateExtractor");
PowerMockStateExtractor se = (PowerMockStateExtractor)
stateKlass.newInstance();
if(state.isInReplayState()) {
// Replace call to new File with a mock object and expect the
invocation on the substitute
} else if(inVerifyState) {
..
} else {
proceed(..);
}
EasyMock and Mockito extension must thus provide different implementations
of powermock.extension.spi.PowerMockStateExtractor.
This would only work if the test case is prepared for test as well.
Original issue reported on code.google.com by johan.ha...@gmail.com on 11 Sep 2009 at 12:56
Original issue reported on code.google.com by
johan.ha...@gmail.com
on 11 Sep 2009 at 12:56