Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Critical
-
Resolution: Unresolved
-
Affects Version/s: 3.0, 3.1
-
Fix Version/s: None
-
Component/s: Core
-
Labels:None
-
Environment:maven and eclipse on windows.
-
Number of attachments :
Description
If i expect a method on a mock to be called once, but call it twice from two different threads (once per thread), easymock does not fail the tests.
If i start two threads, but make two calls from one of them ( uncomment line 97 of ExpirationServiceImpl ) it correctly fails the test.
To demonstrate, untar and 'mvn test' the attached project.
carteda@foobar:/c/dev/workspaces/two/fitp-aggregator/expirationservice$ mvn clean test
[...]
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.nomura.fitp.expirationservice.ExpirationServiceTest
Exception in thread "Thread-1" java.lang.AssertionError:
Unexpected method call ExpirationHandler.handleExpiration(ExpirableTrade [expireTime=1328117827669, tradeId=already expired, tradeVersion=1, originalExpireTime=1328117857800]):
ExpirationHandler.handleExpiration(ExpirableTrade [expireTime=1328117827669, tradeId=already expired, tradeVersion=1, originalExpireTime=0]): expected: 1, actual: 2
ExpirationHandler.handleExpiration(ExpirableTrade [expireTime=1328117828269, tradeId=soon expired, tradeVersion=1, originalExpireTime=0]): expected: 1, actual: 0
at org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:44)
at org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:85)
at $Proxy6.handleExpiration(Unknown Source)
at com.nomura.fitp.expirationservice.internal.ExpirationServiceImpl$Retrier.run(ExpirationServiceImpl.java:120)
at java.lang.Thread.run(Thread.java:662)
Tests run: 4, Failures: 0, Errors: 0, Skipped: 3, Time elapsed: 0.579 sec
Results :
Tests run: 4, Failures: 0, Errors: 0, Skipped: 3
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
Activity
| Field | Original Value | New Value |
|---|---|---|
| Attachment | EASYMOCK-111.diff [ 59444 ] |