Hi All,
>
> I am trying to use the JMock for my application. Here is what I want
> to do.
>
> There is a AccountService class, with a method,
> registerNewAccount(ArrayOfAccount) which returns the
> ArrayOfAccountResponses.
>
> Here is the code snippet :
>
> ---------------
>
> Mockery context = new Mockery();
> final ArrayOfAccount arrayOfAccount = createArrayOfAccount( x,y,z);
> final ArrayOfAccountResponse arrayOfAccountResponse =
> createArrayOfResponse(x,y,z);
> final AccountService client = context.mock(AccountService.class);
>
> context.checking(new Expectations() {{
>
> one(client).registerNewAccount(arrayOfAccount );
> will(returnValue(arrayOfCampaignResponse));
> }});
>
> ---------
>
> Now on invoking the registerNewAccount method, in further in the
> code, I am
> getting following exceptions.
>
>
> unexpected invocation:
> accountService.registerNewAccount(<ext.se.ArrayOfA ccount@e2018282>)
>
> expectations:
>
> expected exactly 1 time, never invoked:
> accountService.registerNewAccount(<ext.se.ArrayOfA ccount@f6c7020c>);
> returns
> <ext.se.ArrayOfAccountResponse@f6c72da4>
>
> at
> org
> .jmock
> .internal.InvocationDispatcher.dispatch(Invocation Dispatcher.java:56)
> at org.jmock.Mockery.dispatch(Mockery.java:204)
> at org.jmock.Mockery.access$000(Mockery.java:37)
> at org.jmock.Mockery$MockObject.invoke(Mockery.java:2 46)
>
> ..and so on
>
>
> I request the experts here to please guide me in resolving this.
>
>
>
> Thanks,
> Tanvi Jain