This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi all, I am having a problem with EasyMock, I have a test that requires the mocking of an object (I have achived this). However the Object (A) then calls another object (I) (which has an interface) which should throw an exception.
Now both A and I both implment the same interface, what has happened is i am wrapping/decorating(?) an object of type I to provide some logging.
So the client calls A.methodX, which maps though to I.methodX, so I would expect two calls to methodX.
however EasyMock only seems to recognise the calls to A and not to the internal object of A that is represented by I.
Sorry I dont know how to make that make anymore sense.
Any ideas? I am on the verge of just making teh whole test use class Extension.
Joined: Jan 01, 2007
A small code example to help:
A is being moced as classes extension, while something/I is using normal EasyMock.
When you ask EasyMock to create a mock object for "ClassToMock.class", you're effectively getting back a completely mocked out fake thing. In other words, whatever methods you invoke on that mock object, the only thing that happens is what would happen with a mock created for an interface -- the original code is not executed.