Java Mailing List Archive

http://www.gg3721.com/

Home » user.jmock »

[jmock-user] help requested in resolving - *unexpected invoaction*

Joglekar

2008-04-30

Replies: Find Java Web Hosting

Author LoginPost Reply

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.ArrayOfAccount@(protected)>)

expectations:

expected exactly 1 time, never invoked:
accountService.registerNewAccount(<ext.se.ArrayOfAccount@(protected)
<ext.se.ArrayOfAccountResponse@(protected)>

       at
org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.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:246)

..and so on


I request the experts here to please guide me in resolving this.



Thanks,
Kedar Joglekar
--
Sent from the jMock - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.