### Question:
PrintWidget implements IsWidget { @Override public Widget asWidget() { return presenter.getView().asWidget(); } PrintWidget(MapPresenter mapPresenter, String applicationId);  PrintWidget(MapPresenter mapPresenter, String applicationId, PrintWidgetView view); @Override Widget asWidget(); void registerLayerBuilder(PrintableLayerBuilder layerBuilder); void setTemplateBuilderFactory(TemplateBuilderFactory templateBuilderFactory); HandlerRegistration setPrintRequestHandler(PrintRequestHandler handler);  }### Answer:
@Test public void defaultWidgetAsWidgetTest() { Assert.assertEquals(widgetMock, printWidget.asWidget()); }
@Test public void customViewAsWidgetTest() { PrintWidgetView customPrintWidgetViewMock = mock(PrintWidgetView.class); Widget customWidgetMock = mock(Widget.class); stub(customPrintWidgetViewMock.asWidget()).toReturn(customWidgetMock); printWidget = new PrintWidget(mapPresenterMock, "applicationId", customPrintWidgetViewMock); Assert.assertEquals(customWidgetMock, printWidget.asWidget()); }