
U - Mock type returned by UiBinder.createAndBindUi(Object).O - Owner type.public abstract class MockingBinder<U,O> extends Object implements UiBinder<U,O>
MockingBinder makes testing view even easier by mocking every
UiField and returning a mocked object upon creation.
To use it, you should build a small class that extends MockingBinder and bind
that class inside your Guice test module. You will have to provide a
MockFactory to let MockingBinder mock everything.
Ex:
public static class Module extends JukitoModule {
static class MyTestBinder extends MockingBinder<Widget, BlogView> implements
Binder {
public MyTestBinder(final AnyMockFactory anyMockFactory) {
super(Widget.class, anyMockFactory);
}
}
protected void configureTest() {
GWTMockUtilities.disarm();
bind(Binder.class).to(MyTestBinder.class);
}
}
Disarming GWT is important to unit test views.| Constructor and Description |
|---|
MockingBinder(Class<U> returnTypeClass,
MockFactory mockFactory) |
public MockingBinder(Class<U> returnTypeClass, MockFactory mockFactory)
returnTypeClass - Type to return when creating the mocked ui.mockFactory - A MockFactory to provide mock object.public U createAndBindUi(O owner) throws IllegalArgumentException
createAndBindUi in interface UiBinder<U,O>IllegalArgumentExceptionCopyright © 2010-2014 ArcBees. All Rights Reserved.