Jukito: How to instantiate Widget while testing view
I have Jukito test like this:
@RunWith(JukitoRunner.class)
public class HomeViewTest extends ViewTestBase {
@Inject
private HomeView homeView;
public static class Module extends ViewTestModule {
@Override
protected void configureViewTest() {
bind(HomeView.Binder.class).to(HomeTestBinder.class);
}
static class HomeTestBinder extends MockingBinder<Widget, HomeView> implements HomeView.Binder {
@Inject
public HomeTestBinder(final MockFactory mockitoMockFactory) {
super(Widget.class, mockitoMockFactory);
}
}
}
}
In home view I'm creating new instance of widget HTML. Как это
final HTML connectToServer = new HTML();
But test fails with follow exception:
Caused by: java.lang.UnsatisfiedLinkError: com.google.gwt.dom.client.Document.nativeGet()Lcom/google/gwt/dom/client/Document;
at com.google.gwt.dom.client.Document.nativeGet(Native Method)
at com.google.gwt.dom.client.Document.get(Document.java:46)
at com.google.gwt.user.client.ui.HTML.<init>(HTML.java:84)
Я попробовал forceMock()
но это не помогло Among this I tried to inject HTML in constructor through com.google.inject.Provider
, It works but I don't like this workaround.
So, any suggestions is appriciated.