You should not have logic that you would like to test in the class where you are using the UiBinder. Have that class implement an interface, put the logic in a another class that receives an instance of that interface. When unit testing pass a mock object of that interface.
http://extgwt-mvp4g-gae.blogspot.com/2009/10/gwt-app-architecture-best-practices_29.html On Apr 2, 10:30 am, Phuong Nguyen <[email protected]> wrote: > It's cool that Google provide GWTMockUtilities to facilitate testing > without launching any web server. > However, it doesn't solve the problem withUiBinder. > For example, I have a ui.xml file and a class: > public class XView extends Composite { > interface XViewUiBinder extendsUiBinder<Widget, SubjectView> { > } > > private static final XViewUiBinder binder =GWT > .create(XViewUiBinder.class); > @UiField > HTMLPanel somePanel; > > public SubjectView() { > initWidget(binder.createAndBindUi(this)); > } > > } > > When I bring GWTMockUtilities into use, the XView can no longer be > instantiated, becauseGWT.createwill return null (so, I got a null > binder). > > Is there any different way to do this? (TestGWTcode without > launching a web server) -- 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.
