-
Jul 22nd, 2010, 05:36 PM
#1
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
-
Jul 27th, 2010, 08:16 AM
#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
-
Jul 27th, 2010, 10:17 AM
#3
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
-
Forum Rules