Hi,
I'm following the MVP pattern as described in the tutorials and in to Ray
Ryan's talk in Google IO 2009.
I hit an issue when it comes to testing a widget that implements more than
one interface.
Suppose you have a view for displaying, say, contact information; the view
has a checkbox, indicating whether the user has a mobile phone and a text
field, with his phone number.
When the checkbox is unchecked, the text field is disabled.
Now, according to Google's guidelines for MVP, I would create the following
interface. Instead of Checkbox, the return type is HasValue<Boolean>; the
nice thing about lighter-weight return types is that they can easily be
mocked and run as fast JUnit tests in the JRE.
interface ContactView {
HasValue<Boolean> getHasMobilePhone();
??? getMobilePhoneNumber();
}
Now, what should be the return type of method getMobilePhoneNumber() ? This
return type should define both getValue() and setEnabled(boolean), and
should be one that class TextField implements. HasValue<String> and
HasEnabled are candidates, but each lacks the methods in the other, and I
can only use one of them as a return type.
Have you faced the same problem ? How did you solve it ?
Thanks,
Leonel
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/XyspywT4uhAJ.
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.