Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Testing and the fly likes EASYMOCK and threads? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "EASYMOCK and threads?" Watch "EASYMOCK and threads?" New topic

EASYMOCK and threads?

Zack Mccraken

Joined: May 17, 2011
Posts: 2
With EasyMock 3, My test runs and pass individually, but not pass when I run all test of a package at the same time. I do the setup (EasyMock.createNiceMock...)
and the tearDown (EasyMock.resetToDefault()...). The trace is:

ava.lang.IllegalStateException: 0 matchers expected, 1 recorded.
This exception usually occurs when matchers are mixed with raw values when recording a method:
foo(5, eq(6)); // wrong
You need to use no matcher at all or a matcher for every single param:
foo(eq(5), eq(6)); // right
foo(5, 6); // also right....

The matchers are correct (individually works). I insert one parameter. But when I run the entire package, and debug inside Easymock, it enters in a for loop. Inside it it puts the same matcher twice in the method. and appears this error,

Some clue?

Zack Mccraken

Joined: May 17, 2011
Posts: 2
nop, the exception is:

ava.lang.IllegalStateException: 1 matchers expected, 2 recorded.
Henri Tremblay

Joined: May 21, 2009
Posts: 7
Can you provide a complete example?

Henri Tremblay
Senior architect
Octo Technology
I agree. Here's the link:
subject: EASYMOCK and threads?
It's not a secret anymore!