Menu

#4 More documentation for SetupResult.forEventDispatcher

open
nobody
Misc (6)
5
2009-04-16
2009-04-16
No

It would be really useful to get more documentation for SetupResult.forEventDispatcher. We've run into the assertion error below and were wondering if this is where we needed to use such a method. The code we actually call is:

Expect.call(mockNotificationManager.dispatchEvent(new ChatMessageReceivedNotification(CHAT_ID, message.body, message.from.resource, null))).returnValue(true);

and the error is:

<testcase classname="HostRoomProxyTest" name="testRoomLockedIfChatMessageReceivedAndRoomNotLocked" time="0">
<error type="asmock.framework.ExpectationViolationError">asmock.generated:IEventDispatcher6E60A431E75FAE4BDDF07A37272F437CE96FF087/dispatchEvent([Event type="receiveMessage" bubbles=false cancelable=fal
se eventPhase=2]); Expected #0, Actual #1. asmock.generated:IEventDispatcher6E60A431E75FAE4BDDF07A37272F437CE96FF087/dispatchEvent([Event type="receiveMessage" bubbles=false cancelable=false eventPhase=2]);
Expected #1, Actual #0.</error>

Many thanks

Discussion

  • Richard Szalay

    Richard Szalay - 2009-08-09

    ASMock 0.9 has been updated with a new quick start guide that has an entire section on stubbing events, though SetupResult.forEventDispatcher has actually been deprecated in favour of MockRepository.stubEvents. https://sourceforge.net/apps/mediawiki/asmock/index.php?title=Stubbing_Events

     
  • Richard Szalay

    Richard Szalay - 2010-04-11

    This API has been superceded by MockRepository.createStub with StubOptions. What you are describing certainly looks like a bug, but it may have been fixed in a future commit. Apologies for the ridiculously late response, by the way.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.