### Question:
FragmentHandler extends AbstractXulEventHandler { protected void showMessage( String message ) { try { XulMessageBox box = (XulMessageBox) document.createElement( "messagebox" ); box.setMessage( message ); box.open(); } catch ( XulException e ) { System.out.println( "Error creating messagebox " + e.getMessage() ); } } FragmentHandler(); void refreshOptions(); Object getData(); void setData( Object arg0 );  }### Answer:
@Test public void testShowMessage() throws Exception { XulMessageBox messageBox = mock( XulMessageBox.class ); when( document.createElement( "messagebox" ) ).thenReturn( messageBox ); fragmentHandler.showMessage( null ); when( document.createElement( "messagebox" ) ).thenThrow( new XulException() ); fragmentHandler.showMessage( "" ); }