The DOM class contains a static class variable "impl" that is instantiated 
using GWT.create(). I don't think you can workaround this fact using 
PowerMockito.

What you can do is to refactor your code slightly. Instead of

public Foo() {
  id = DOM.createUniqueId();
}

you would refactor it to

public Foo(IdGenerator idGenerator) {
  id = idGenerator.createUniqueId();
}

where IdGenerator is an interface. You can then create a default 
implementation of that interface that uses DOM.createUniqueId() in your 
production code and during testing you can then mock that interface easily.

If you don't want that, you have to use a slow GWTTestCase to make 
GWT.create() work. 

You could also move that code into a view implementation that would need a 
GWTTestCase anyways if you choose to test that view implementation.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to