com.google.gwtmockito.GwtMockito Java Examples
The following examples show how to use
com.google.gwtmockito.GwtMockito.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MyWidgetTestWithoutRunner.java From pitest with Apache License 2.0 | 6 votes |
@Before public void setUp() { GwtMockito.initMocks(this); widget = new MyWidget() { @Override protected void initWidget(Widget widget) { // initWidget must be disarmed when testing widget to avoid // UnsatisfiedLinkErrors } @Override Element doStuffInJavaScript() { // JSNI methods must be explicitly overridden or factored out to avoid // UnsatisfiedLinkErrors return null; } }; }
Example #2
Source File: MyWidgetTestWithoutRunner.java From gwtmockito with Apache License 2.0 | 6 votes |
@Before public void setUp() { GwtMockito.initMocks(this); widget = new MyWidget() { @Override protected void initWidget(Widget widget) { // initWidget must be disarmed when testing widget to avoid // UnsatisfiedLinkErrors } @Override Element doStuffInJavaScript() { // JSNI methods must be explicitly overridden or factored out to avoid // UnsatisfiedLinkErrors return null; } }; }
Example #3
Source File: GwtMockitoRpcWithoutGwtMockTest.java From gwtmockito with Apache License 2.0 | 6 votes |
@Test public void shouldUseFakeIfProvided() { GwtMockito.useProviderForType( TestRemoteService.class, new FakeProvider<TestRemoteServiceAsync>() { @Override public TestRemoteServiceAsync getFake(Class<?> type) { TestRemoteServiceAsync mock = mock(TestRemoteServiceAsync.class); doAnswer(returnSuccess("faked")).when(mock).doRpcWithoutArgs(anyAsyncCallback()); return mock; } }); MyWidget widget = new MyWidget(); verify(widget.message).setText("faked"); }
Example #4
Source File: GwtMockitoRpcTest.java From gwtmockito with Apache License 2.0 | 6 votes |
@Test public void gwtMockShouldTakePriorityOverFakes() { doAnswer(returnSuccess("mocked")).when(service).doRpcWithoutArgs(anyAsyncCallback()); GwtMockito.useProviderForType( TestRemoteService.class, new FakeProvider<TestRemoteServiceAsync>() { @Override public TestRemoteServiceAsync getFake(Class<?> type) { TestRemoteServiceAsync mock = mock(TestRemoteServiceAsync.class); doAnswer(returnSuccess("faked")).when(mock).doRpcWithoutArgs(anyAsyncCallback()); return mock; } }); MyWidgetWithoutArgs widget = new MyWidgetWithoutArgs(); verify(widget.message).setText("mocked"); }