-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Powermock/mockito is able to do the same as we do with Aspectj without any special command line, making the usage easier. It seems to do bytecode manipulation to do the work.
Instead of doing the same, maybe powermock + mockito can be used instead.
After somehow discovered all the annotation, generate code that calls:
For Record:
ClassToRecord classToRecord(new ClassToRecord());
ClassToRecord classUnderTestSpy = PowerMockito.spy(classToRecord);
whenNew(ClassToRecord.class).withNoArguments().thenReturn(classUnderTestSpy);
Mockito.when(classUnderTest.methodToMock()).thenAnswer(recordingAnswer);
An answer class receives parameters so we can record and then call the real class:
Dependency:
Do the same. On playback we can let answer class return recorded values instead.