I have a solution to this in gwt-remote-action<http://code.google.com/p/gwt-remote-action/>. I create a real TypeOracle and feed it the actual .java files from GWT for the JRE and some GWT classes, then I feed it the .java files for the test interfaces that are to be generated and run my unit tests using that TypeOracle. See here<http://code.google.com/p/gwt-remote-action/source/browse/core/src/test/java/com/google/gwt/dev/javac#javac>for the code that builds the TypeOracle and here<http://code.google.com/p/gwt-remote-action/source/browse/core/src/test/java/com/google/code/gwt/remoteaction/rebind/RebindTestCase.java> for how it gets used for a test case. It takes a couple seconds to build the TypeOracle so I use a static to save it and reuse it for multiple tests. If this is useful to others I can factor it out of gwt-remote-action into a separate library that folks can use.
It turns out there actually are mocks for some Generator related things in GWT, but there's basically just enough to support the unit tests in GWT. They also don't get included in any of the GWT jars, so you'd have to just grab them from the GWT source to use them. See here<http://code.google.com/p/google-web-toolkit/source/browse/trunk/dev/core/test/com/google/gwt/dev/javac/impl/> and here<http://code.google.com/p/google-web-toolkit/source/browse/trunk/dev/core/test/com/google/gwt/dev/javac/TypeOracleTestingUtils.java> for some of that code. Jamie On Thu, Dec 17, 2009 at 8:58 AM, Gal Dolber <gal.dol...@gmail.com> wrote: > I am asking myself the same. I couldn't find any way to do that, but you > can always test the generated one. > > There is another tip: > If you compile the project and specify the -gen argument to the compiler, > then execute the project on debug mode and attach to the project the gen > directory like source lookup and you can debug the generated class line by > line, thats pretty nice to find bugs. > > 2009/12/17 hjo1620 <hjo1...@gmail.com> > > I have a "class MyGenerator extends Generator", that I want to test. >> >> I need pointers to existing unit test code of a Generator unittest. >> >> Looked in the GWT code for readymade mocks to no avail. >> >> /hw >> >> -- >> >> 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<google-web-toolkit%2bunsubscr...@googlegroups.com> >> . >> 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 google-web-tool...@googlegroups.com. > To unsubscribe from this group, send email to > google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com> > . > 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 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.