Ujug-Forum
Welcome, Guest
Please Login or Register.
Lost Password?
Re:Mocks not mocking method calls. (1 viewing)
_GEN_GOTOBOTTOM Post Reply

TOPIC: Re:Mocks not mocking method calls.

#86
lightguard (User)
Junior Boarder
Posts: 7
graphgraph
Mocks not mocking method calls. 2007/10/16 12:02 Karma: 0  
I'm using EasyMock 2.3 (tried Groovy Mocks as well, same problem) and it seems like one of the methods I have expected in my mock is still running the actual code. Example

Code:

public class Foo { ... public int foo(Object, int) {     ...     Bar otherClass = new Bar();     otherClass.doSomething();     ... } ...



Mock:
Code:

... Foo mockFoo = createMock(Foo.class) expect(mockFoo.foo(new Object(), 4)).andReturn(3); ...



There's the method I'm expecting, but when I mock it up it still runs that code. I'd love to know how to get it to work correctly. Anyone have any ideas?

Edit: BTW, I'm using ClassExtensions to mock the class.

Post edited by: lightguard, at: 2007/10/16 12:07
  The administrator has disabled public write access.
#87
lightguard (User)
Junior Boarder
Posts: 7
graphgraph
Re:Mocks not mocking method calls. 2007/10/16 14:40 Karma: 0  
I feel like a moron. The method I was trying to mock was final.
  The administrator has disabled public write access.
_GEN_GOTOTOP Post Reply
© Copyright 2007 Best of Joomla, Powered by FireBoardget the latest posts directly to your desktop
Colocation provided by Tier Four