Replace try-catch-fail patterns with assertThatCode in ExplodedGraphWalkerTest#113
Open
sonarqube-agent[bot] wants to merge 1 commit into
Open
Replace try-catch-fail patterns with assertThatCode in ExplodedGraphWalkerTest#113sonarqube-agent[bot] wants to merge 1 commit into
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AZ6v0pMz6JKQzmjWaP0A for java:S8714 rule - AZ6v0pMz6JKQzmjWaP0B for java:S8714 rule - AZ6v0pMz6JKQzmjWaP0C for java:S8714 rule - AZ6v0pMz6JKQzmjWaP0D for java:S8714 rule - AZ6v0pMz6JKQzmjWaP0E for java:S8714 rule Generated by SonarQube Agent (task: 31b8045e-3508-4981-9d44-4bd3e7bce6fe)
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.
Refactors multiple test assertions in ExplodedGraphWalkerTest to use AssertJ's assertThatCode() instead of try-catch-fail anti-patterns, improving test code clarity and maintainability. This resolves 5 SonarQube S8714 issues that flag outdated exception assertion patterns in favor of modern, more readable assertion methods.
View Project in SonarCloud
Fixed Issues
java:S8714 - Use assertThrows() instead of try/catch and fail() in the try block. • MINOR • View issue
Location:
sonar-java-symbolic-execution:java-symbolic-execution/java-symbolic-execution-plugin/src/test/java/org/sonar/java/se/ExplodedGraphWalkerTest.java:321Why is this an issue?
Modern assertion libraries have made the clunky
try-fail-catchpattern obsolete by introducing cleaner alternatives. For example, starting with JUnit 5, JUnit Jupiter providesassertThrowsandassertDoesNotThrow. AssertJ offers similar methods.What changed
Adds the import for
assertThatCodefrom AssertJ, which is needed by hunks 2 and 4 that replace try-catch-fail patterns withassertThatCode(...).doesNotThrowAnyException(). This import is required to support the refactoring of all the try-catch-fail anti-patterns identified in the file.java:S8714 - Use assertThrows() instead of try/catch and fail() in the try block. • MINOR • View issue
Location:
sonar-java-symbolic-execution:java-symbolic-execution/java-symbolic-execution-plugin/src/test/java/org/sonar/java/se/ExplodedGraphWalkerTest.java:321Why is this an issue?
Modern assertion libraries have made the clunky
try-fail-catchpattern obsolete by introducing cleaner alternatives. For example, starting with JUnit 5, JUnit Jupiter providesassertThrowsandassertDoesNotThrow. AssertJ offers similar methods.What changed
Adds the import for
assertThatCodefrom AssertJ, which is needed by hunks 2 and 4 that replace try-catch-fail patterns withassertThatCode(...).doesNotThrowAnyException(). This import is required to support the refactoring of all the try-catch-fail anti-patterns identified in the file.java:S8714 - Use assertDoesNotThrow() instead of try/catch and fail() in the catch block. • MINOR • View issue
Location:
sonar-java-symbolic-execution:java-symbolic-execution/java-symbolic-execution-plugin/src/test/java/org/sonar/java/se/ExplodedGraphWalkerTest.java:343Why is this an issue?
Modern assertion libraries have made the clunky
try-fail-catchpattern obsolete by introducing cleaner alternatives. For example, starting with JUnit 5, JUnit Jupiter providesassertThrowsandassertDoesNotThrow. AssertJ offers similar methods.What changed
Adds the import for
assertThatCodefrom AssertJ, which is needed by hunks 2 and 4 that replace try-catch-fail patterns withassertThatCode(...).doesNotThrowAnyException(). This import is required to support the refactoring of all the try-catch-fail anti-patterns identified in the file.java:S8714 - Use assertDoesNotThrow() instead of try/catch and fail() in the catch block. • MINOR • View issue
Location:
sonar-java-symbolic-execution:java-symbolic-execution/java-symbolic-execution-plugin/src/test/java/org/sonar/java/se/ExplodedGraphWalkerTest.java:343Why is this an issue?
Modern assertion libraries have made the clunky
try-fail-catchpattern obsolete by introducing cleaner alternatives. For example, starting with JUnit 5, JUnit Jupiter providesassertThrowsandassertDoesNotThrow. AssertJ offers similar methods.What changed
Adds the import for
assertThatCodefrom AssertJ, which is needed by hunks 2 and 4 that replace try-catch-fail patterns withassertThatCode(...).doesNotThrowAnyException(). This import is required to support the refactoring of all the try-catch-fail anti-patterns identified in the file.java:S8714 - Use assertDoesNotThrow() instead of try/catch and fail() in the catch block. • MINOR • View issue
Location:
sonar-java-symbolic-execution:java-symbolic-execution/java-symbolic-execution-plugin/src/test/java/org/sonar/java/se/ExplodedGraphWalkerTest.java:302Why is this an issue?
Modern assertion libraries have made the clunky
try-fail-catchpattern obsolete by introducing cleaner alternatives. For example, starting with JUnit 5, JUnit Jupiter providesassertThrowsandassertDoesNotThrow. AssertJ offers similar methods.What changed
Adds the import for
assertThatCodefrom AssertJ, which is needed by hunks 2 and 4 that replace try-catch-fail patterns withassertThatCode(...).doesNotThrowAnyException(). This import is required to support the refactoring of all the try-catch-fail anti-patterns identified in the file.SonarQube Remediation Agent uses AI. Check for mistakes.