views:

309

answers:

2

I've got this in mycode:

import static org.easymock.classextension.EasyMock.createMock;
import static org.easymock.classextension.EasyMock.replay;
import static org.easymock.classextension.EasyMock.reset;
import static org.easymock.classextension.EasyMock.verify;

...

mockMember = createMock(Member.class);
mockMember.incrPlayInPlay(200);

Because I want to tst that the method incrPlayInPlay is called. However, mockMember.incrPlayInPlay is actually calling the method in the concrete class, not setting up the expectations for the mock. What am I doing wrong?

+2  A: 

Derr... The method was defined as final. Silly me. Hope this helps another silly person in the future

James Massey
A: 

If you need to, you can mock final methods using PowerMock, which does some on-the-fly bytecode munging to remove the final modifier.

http://code.google.com/p/powermock/

oksayt