The method getAccountByAccountKey below is where I'm getting the " unexpected invocation" error
mockLinkedServiceAccountDao = mock(LinkedServiceAccountDao.class);
mockLinkedServiceAccountDao.verify();
linkedServiceAccountDao = (LinkedServiceAccountDao) mockLinkedServiceAccountDao.proxy();
accountId = ((Account) linkedServiceAccountDao.getAccountByAccountKey(ban).get(0)).getId();
System.out.println("## accountId : " + accountId.toString());
mockLinkedServiceAccountDao.expects(once()).method("getAccountByAccountKey").with(eq(new Long(1))).will(returnValue(accountId));
junit ] Testcase: test1 took 0.14 sec
[ junit ] FAILED
[ junit ] mockLinkedServiceAccountDao: unexpected invocation
[ junit ] Invoked: mockLinkedServiceAccountDao.getAccountByAccountKey("1234567890")
[ junit ] Allowed:
[ junit ] No expectations set
[ junit ] org.jmock.core.DynamicMockError: mockLinkedServiceAccountDao: unexpected invocation
[ junit ] Invoked: mockLinkedServiceAccountDao.getAccountByAccountKey("1234567890")
[ junit ] Allowed:
[ junit ] No expectations set
[ junit ] at org.jmock.core.AbstractDynamicMock.mockInvocation( AbstractDynamicMock.java:95
--
What's causing this?