how to mock/make available different event class in my test case in gwt mvp app testing?

135 views Asked by At

i'm using gwtp and i'm writing some tests on my view,i have some events like ChangeEvent, clickEvent in my view so how can i obtain these objects i tried by mocking but it is not working.

the code in my view is

`@UiHandler("submit") void onClickSubmit(ClickEvent e) { doClick(); }

@UiHandler("change")
public void onChange(ChangeEvent e) {
    doChange();
}

`

1

There are 1 answers

1
Sydney On BEST ANSWER

Try to reverse the MVP pattern. This way you will need to test only the presenter. Remember in MVP, the view is supposed to be "dumb". The goal is to avoid testing the view.

http://arcbees.wordpress.com/2010/09/03/reversing-the-mvp-pattern-and-using-uihandler/