I looked at that (and crawled the classes). I'm struggling with the generic bind as the bind is bind(Class).to(Class) but I would effectively need bind(Class).to(Mocked instance of Class).
-Dave On Tuesday, September 3, 2013 4:03:37 PM UTC-5, Nate Bauernfeind wrote: > > Have you considered crawling all of your classes and writing a generic > bind method that you can call for any found class that extends View? (see: > http://www.javaworld.com/javaworld/javatips/jw-javatip113.html?page=2) > > > On Tue, Sep 3, 2013 at 3:44 PM, David Parish <[email protected]<javascript:> > > wrote: > >> We use GWT, GIN and the MVP pattern. All the views inherit from the same >> base interface (our.View). I'm trying to create more tests but the number >> of views has gotten rather large. Can I take advantage of the fact that >> all views inherit from the base View and somehow inject a Mock of the >> interface without having to list all 100+ views in a bind statement. >> >> A simple example: >> >> The base interface: >> public interface View { >> public Widget asWidget(); >> } >> >> A simple "real" View: >> public interface MyView extends View { >> interface Presenter { >> void submitClicked(); >> } >> setPresenter(Presenter p); >> submitSuccessful(); >> } >> >> I'd like my Test Inject Module to automatically create a Mock of MyView >> (and any other class that extends View) whenever it encounters an interface >> that extends View. >> >> I looked at bindListener but that only seems to allow you to affect an >> already created instance. >> >> Thanks, >> -Dave >> >> -- >> You received this message because you are subscribed to the Google Groups >> "google-guice" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/google-guice. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-guice. For more options, visit https://groups.google.com/groups/opt_out.
