Skip to content

Fail exception tests when nothing is thrown - #1209

Merged
rbri merged 1 commit into
HtmlUnit:masterfrom
sharanggupta:exception-tests-can-fail
Nov 26, 2026
Merged

rbri merged 1 commit into
HtmlUnit:masterfrom
sharanggupta:exception-tests-can-fail

Conversation

@sharanggupta

Copy link
Copy Markdown
Contributor

ScriptExceptionTest.getPage, WebClientTest.redirectionSameURL and JavaScriptEngineTest.scriptErrorContainsPageUrl call the code under test inside try/catch without a fail(), so they also pass when no exception is thrown. They now use assertThrows and keep their checks on the exception.

getPage, redirectionSameURL and scriptErrorContainsPageUrl caught the
expected exception without a fail(), so they also passed when it was
never thrown.
@sonarqubecloud

Copy link
Copy Markdown

@rbri
rbri merged commit cc0a270 into HtmlUnit:master Nov 26, 2026
7 checks passed
@rbri

rbri commented Nov 26, 2026

Copy link
Copy Markdown
Member

great catch, many thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants