DriverDetailsDialogController extends AbstractController { SwtDialog getDialog() { return getElementById( DriverDetailsDialog.XUL_DIALOG_ID ); } DriverDetailsDialogController(); @SuppressWarnings( "unused" ) // Bound via XUL void saveDriver(); @SuppressWarnings( "unused" ) // Bound via XUL void showHelp(); @SuppressWarnings( "unused" ) // Bound via XUL void close();  }
@Test public void testGetDialog() throws Exception { doCallRealMethod().when( controller ).getDialog(); SwtDialog dialog = mock( SwtDialog.class ); doReturn( dialog ).when( controller ).getElementById( DriverDetailsDialog.XUL_DIALOG_ID ); assertThat( dialog, is( sameInstance( controller.getDialog() ) ) ); }