We have developed some code which analyzes annotated methods and adds some runtime behaviour. I would like to test this. Currently I am hand-coding stubs with certain annotations for setting up my test-case.
Usually I am using a mocking-framework (currently easymock) to avoid hand-coding test-doubles (stubs or mocks). But I haven't found a way to use mocking-frameworks to annotate my test-doubles. This is cumbersome because it involves having a lot of stupid-dummy source code, which is annoying to maintain (reading, writing and refactoring tests).
Something like:
MyAnnotation annoMock = createMock(MyAnnotation.class);
record(annoMock.getSupported()).andReturn(true);
....
annotate(method).with(annoMock);
Does somebody know whether there is such a record-feature especially for annotations (all targets like method,class, fields etc.) for easymock? if not available for easymock is there an alternative mock-library?