Skip to content

CODEC-285 Base32InputStreamTest testReadOutOfBounds#43

Closed
nhojpatrick wants to merge 4 commits into
apache:masterfrom
nhojpatrick:CODEC-285_Base32InputStreamTest_testReadOutOfBounds
Closed

CODEC-285 Base32InputStreamTest testReadOutOfBounds#43
nhojpatrick wants to merge 4 commits into
apache:masterfrom
nhojpatrick:CODEC-285_Base32InputStreamTest_testReadOutOfBounds

Conversation

@nhojpatrick

Copy link
Copy Markdown
Contributor

Follow up for PR #39

From experience people write tests that don't check exceptions correctly, either they are not thrown, or a different than expected line throws that exception, or it's the wrong exception, or wrong message.

Using assertAll and assertThrows to explicitly check the expected line throws the expected exception, and all done in parallel not sequentially.

@coveralls

coveralls commented Mar 4, 2020

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 93.976% when pulling dc77c32 on nhojpatrick:CODEC-285_Base32InputStreamTest_testReadOutOfBounds into e87ac43 on apache:master.

@nhojpatrick nhojpatrick force-pushed the CODEC-285_Base32InputStreamTest_testReadOutOfBounds branch from 8fb8d75 to dc77c32 Compare August 15, 2020 10:54
@nhojpatrick nhojpatrick force-pushed the CODEC-285_Base32InputStreamTest_testReadOutOfBounds branch from dc77c32 to 5124cc9 Compare February 13, 2022 22:23
@nhojpatrick nhojpatrick force-pushed the CODEC-285_Base32InputStreamTest_testReadOutOfBounds branch from 5124cc9 to 25f3e97 Compare February 13, 2022 22:29
@garydgregory

Copy link
Copy Markdown
Member

Please, let's not add assertions on the contents of exception messages, that's a maintenance headache.

@nhojpatrick

Copy link
Copy Markdown
Contributor Author

Not checking exception message it like just checking a method returns a non null value.
Anyone changing a method would expect to have to fix any tests they break, so why not any tests asserting the message?
I've done this multiple times as discovered tests are not checking what your expecting, they are failing with the correct throwable type but not for the correct reason.

It's not like I'm checking the stackstrace and asserting the correct line that the test is expecting is throwing the exception.

@garydgregory

Copy link
Copy Markdown
Member

Closing: Superseded in git master (commit 5a03f5a)

@nhojpatrick nhojpatrick deleted the CODEC-285_Base32InputStreamTest_testReadOutOfBounds branch February 19, 2022 21:13
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.

3 participants