Dependency injection would work very well here. The article on MVP with Activities and Places has a really good example of using GWT.create() only in onModuleLoad() and then using manual dependency injection to pass in your dependencies without GIN.
Here's the article: http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html Hope it helps! On Oct 28, 8:48 am, Happy Feet <kristian.jones...@googlemail.com> wrote: > Hi All, > This is my first post here so please be gentle. > > I've joined a project where message bundles/property files are exposed > to client code using GWT.create(PropertyFileName.class). This makes it > very easy to assign read in values for fields, popups, labels, errors > etc. > > Now the BUT, we want to increase the coverage of our Junit tests but > are hitting the classic "GWT.create() is only useable in client code" > when trying to unit test some of our classes. It appears that in some > lower level classes the property file references have been declared > using GWT.create rather than been passed into the widget, event > handler etc from the presenter. > > Can anyone recommend any solutions. I thought Dependency Injection > might be useful here but I'm new to that as a technolgoy and have no > previous experience with Gin or Guice. > > Will dependancy injection help here? Does anyone have an example? > Would an alternative be a better fit? > > Hope that all makes sense, thanks in advance. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.