Repository navigation
Leave tests that call assumptions alone in TestsShouldIncludeAssertions - #1213
Merged
Merged
Conversation
…ons`
A test such as `assumeTrue(isLinux()); service.start();` has no assertion, so the recipe wrapped its body in `assertDoesNotThrow(() -> {...})`. That catches the `TestAbortedException` thrown by a failed assumption and reports a test that should have been skipped as a failure. Calls to JUnit Jupiter `Assumptions`, JUnit 4 `Assume` and AssertJ `Assumptions` now make the recipe leave the test unchanged.
…sertj.core.api` assertion prefix
23 of 76 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TestsShouldIncludeAssertionsdidn't treat assumptions as anything special, so a test guarded by an assumption but without an assertion got its body wrapped inassertDoesNotThrow:assertDoesNotThrowcatches theTestAbortedExceptiona failed assumption throws, so a test that should have been skipped on other platforms now fails there.The recipe now leaves a test unchanged when its body (or a helper it calls in the same class) calls JUnit Jupiter
Assumptions, JUnit 4Assume, or AssertJAssumptions. The description mentions this too.Fixes item C3 of #1211.