Results 1 to 3 of 3

Thread: Testing EventBus

  1. #1
    Join Date
    Jun 2007
    Posts
    2

    Default 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. #2
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    407

    Default

    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

  3. #3
    Join Date
    Jun 2007
    Posts
    2

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •