Announcement Announcement Module
Collapse
No announcement yet.
Testing EventBus Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Testing EventBus

    I'd like to create tests that check the EventBus is dispatching expected events using mocking. I attempted to use ASMock, but the expect call fails because the event object being dispatched is created in the tested method. What is a recommended design to write tests for the use of EventBus.dispatchEvent?

    Expect.call(eventBus.dispatchEvent(new LoadEvent(LoadEvent.LOAD_DATA)));
    mockRepository.replay(eventBus);
    myclass.eventBus=eventBus;
    myclass.loadData(); //within this class eventBus.dispatchEvent method is called
    mockRepository.verify(eventBus); //failing, even though the proper event is dispatched

  • #2
    Hey there,

    this seems to be more of an ASmock specific question, have you tried the ASMock forums already?

    http://sourceforge.net/projects/asmo...s/forum/905530

    I have the feeling that people over there will be better able to help you out.

    cheers,

    Roland

    Comment


    • #3
      Thanks for the reply. I decided to not use a mock and instead created a wrapper for EventBusFacade for my testing purposes.

      Comment

      Working...
      X