The nice thing about doing it this way is that you can still unit test it 100% in JUnit.
I used EasyMock to mock out my Display interface and any other classes my presenter happened to depend on. This way I could always mock return and assert that the presenter did the right thing. I punted on testing that my Display implementation actually did what it said it would do via the interrace contract, but typically the code was so minimal that I didn't care. On Thu, Jan 14, 2010 at 10:31 PM, Dominik Steiner < [email protected]> wrote: > Hi Davis, > > thanks for the fast reply. > > That is actually a good idea, I was always looking for getters to implement > on the Display, never occured to me that simple methods that go the other > way might be as efficient too. > > Thanks again for your help. > > Dominik > > Hi Dominik, why not have a display interface like this? > > interface Display { > void toggleVisible(boolean toggle); > } > > If you need the presenter to toggle specific widgets on the display create > an enum: > > interface Display { > > enum WidgetType { > BUTTON, > TEXTBOX > }; > > void toggleVisible(boolean toggle, WidgetType type); > } > > On Thu, Jan 14, 2010 at 8:45 PM, Dominik Steiner < > [email protected]> wrote: > >> Hi there, >> >> I'm wondering how you best handle the situation that in your Presenter >> you need to call setVisible() on some UI Object returned via the >> Display interface? >> >> I could of course just write something like this in the Presenter >> >> interface Display{ >> Widget getOkButton(); >> } >> >> but that would made the class not JUnit testable. So I'm wondering why >> there are interfaces in GWT like HasText in order to set text on a >> Label or something but no interface in order to pass that to the >> Presenter for setting the visiblity of an UI element? >> >> Am I missing something? >> >> Dominik >> >> P.S. of course I could just extend the Widget class with my own custom >> ones and let this implement a custom Interface that defines setVisible >> () in order to pass that to the Presenter to make it testable, but >> wondering if others have run into the same problem? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Web Toolkit" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<google-web-toolkit%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/google-web-toolkit?hl=en. >> >> >> >> > > > -- > Zeno Consulting, Inc. > home: http://www.zenoconsulting.biz > blog: http://zenoconsulting.wikidot.com > p: 248.894.4922 > f: 313.884.2977 > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-web-toolkit%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > -- Zeno Consulting, Inc. home: http://www.zenoconsulting.biz blog: http://zenoconsulting.wikidot.com p: 248.894.4922 f: 313.884.2977--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
