I have concrete class that I want to mock. There are several annotated methods with annotations. I want to create class mock but I need to preserve that annotations.
I tried easymock. It subclasses my class without problems, but does not preserve annotations.
I would like to preserve annotations in easymock. If that is impossible are there any other mocking solution?
I prefer mockito which uses a different paradigm for mocking out classes. You don’t have to subclass everything like you do with easymock.
http://code.google.com/p/mockito/
The javadoc itself has a ton of information about how to utilize the library
http://docs.mockito.googlecode.com/hg/latest/org/mockito/Mockito.html#2
Her is a short example from their documentation.
So with this library you setup your tests and stub out the methods that you are interested in testing.
Hope you found this useful.