DataServiceDialogController extends AbstractController { public void showTestDialog() throws XulException { if ( dataServiceHasNoName( model ) ) { return; } delegate.showTestDataServiceDialog( model.getDataService(), getDialog().getShell() ); } DataServiceDialogController( DataServiceModel model, DataServiceDelegate delegate ); void init(); void showTestDialog(); void saveAndClose(); void open(); void close(); @SuppressWarnings( "unused" ) // Bound via XUL void showHelp(); @SuppressWarnings( "unused" ) // Bound via XUL void showDriverDetailsDialog(); void setDataService( DataServiceMeta dataService ); static final String XUL_DIALOG_ID; }
@Test public void testShowTestDialog() throws Exception { controller.showTestDialog(); verify( delegate ).showTestDataServiceDialog( dataServiceMeta, shell ); }
@Test public void testShowsErrorOnTestWithNameEmpty() throws XulException { DataServiceDialogController controller = spy( new DataServiceDialogController( model, delegate ) ); doNothing().when( controller ).error( anyString(), anyString() ); when( model.getServiceName() ).thenReturn( null ); controller.showTestDialog(); verify( controller, times( 1 ) ).error( anyString(), anyString() ); }