#35 Can use argument matchers outside of context

EasyMock_2.5.2
open
EasyMock (40)
5
2012-10-05
2010-05-06
Mathilde Lemee
No

Hi,

If somewhere in the test, someone use an argument matcher outside of a easy mock context like a formatService.scale2((BigDecimal) anyObject()); into an integration test, the framework has some strange comportement :
java.lang.IllegalStateException: 1 matchers expected, 2 recorded.
at org.easymock.internal.ExpectedInvocation.createMissingMatchers(ExpectedInvocation.java:56)
at org.easymock.internal.ExpectedInvocation.<init>(ExpectedInvocation.java:48)
at org.easymock.internal.ExpectedInvocation.<init>(ExpectedInvocation.java:40)
at org.easymock.internal.RecordState.invoke(RecordState.java:76)
at org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:38)
at org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:72)
at $Proxy5.scale(Unknown Source)
at fr.java.freelance.easymock.CalculServiceTest.testAdd(CalculServiceTest.java:40)
on a method that juste have one argument but the matcher of formatService.scale2((BigDecimal) anyObject()); is still in the matchers'list for the one argument method !

Discussion

  • Mathilde Lemee
    Mathilde Lemee
    2010-11-04

    patch

     
    Attachments