### Question:
DataHandler extends AbstractXulEventHandler { public void getOptionHelp() { String message = null; DatabaseMeta database = new DatabaseMeta(); getInfo( database ); String url = database.getExtraOptionsHelpText(); if ( ( url == null ) || ( url.trim().length() == 0 ) ) { message = Messages.getString( "DataHandler.USER_NO_HELP_AVAILABLE" ); showMessage( message, false ); return; } Status status = Launch.openURL( url ); if ( status.equals( Status.Failed ) ) { message = Messages.getString( "DataHandler.USER_UNABLE_TO_LAUNCH_BROWSER", url ); showMessage( message, false ); } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); static final SortedMap<String, DatabaseInterface> connectionMap; static final Map<String, String> connectionNametoID; }### Answer:
@Test public void testGetOptionHelp() throws Exception { when( accessBox.getSelectedItem() ).thenReturn( "JNDI" ); when( connectionBox.getSelectedItem() ).thenReturn( "PostgreSQL" ); dataHandler.getOptionHelp(); }
@Test( expected = RuntimeException.class ) public void testGetOptionHelpNoDatabase() throws Exception { when( accessBox.getSelectedItem() ).thenReturn( "JNDI" ); when( connectionBox.getSelectedItem() ).thenReturn( "MyDB" ); dataHandler.getOptionHelp(); }