java - What kind of exception should go in the catch with assertEquals? -
i'm making webdriver , part of check title make sure on right page. benefit want show dialog box when title doesn't match right give me error message in console. believe it's exception problem. suggestions?
try{ assertequals("current page title", "account inventory - select manager", pagetitle); } catch(exception ex) { jframe frame = new jframe("message"); joptionpane.showmessagedialog(frame , "the title not match"); }
assertequals
throw assertionerror
when condition not met. should either catch error explicitly, or widen catch include throwable
rather exception
.
see type hierarchy diagram below understand why catch (exception e)
won't catch assertionerror
.
java.lang.object |--- java.lang.throwable |--- java.lang.error | --- java.lang.assertionerror // not descendent of exception |--- java.lang.exception
however... tests supposed automated can't imagine why you'd want introduce human element showing dialog.
Comments
Post a Comment