Skip to content

CPC tests: assert the expected AssertionError - #819

Open
sharanggupta wants to merge 1 commit into
apache:mainfrom
sharanggupta:cpc-tests-assert-throws
Open

sharanggupta wants to merge 1 commit into
apache:mainfrom
sharanggupta:cpc-tests-assert-throws

Conversation

@sharanggupta

Copy link
Copy Markdown

RuntimeAssertsTest, CompressedStateTest.checkIsCompressed and CpcWrapperTest.checkIsCompressed use try { ...; fail(); } catch (AssertionError e) { }. TestNG's fail() throws an AssertionError, so the catch swallows it and the tests pass whether or not the code under test throws. They now use assertThrows(AssertionError.class, ...).

With RuntimeAsserts.error() changed to not throw, the seven negative tests in RuntimeAssertsTest now fail.

The tests caught AssertionError around their own fail(), so they
passed whether or not the code under test threw.

This branch has not been deployed

No deployments
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.

1 participant