New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SONARJAVA-4413 Vert.x methods for JUnit5 in AssertionsInTestsCheck #4141
Conversation
20ea12a
to
cf0248d
Compare
Tracked in SONARJAVA-4413 |
@julianladisch, thanks for your PR; it looks nice! Could you please rebase it on Once you solve those conflicts, I will merge your changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please resolve the conflicts, then we will review the changes that overall look very nice!
Add these methods of Eclipse Vert.x with JUnit 5 (VertxTestContext) to list of assertion methods: * laxCheckpoint * succeedingThenComplete Exclude these methods of Eclipse Vert.x with JUnit 5 (VertxTestContext) from list of assertion methods: * verify * failing Upgrade Vert.x version from 3.5.4 to 4.5.1. This requires code changes in VertxJUnit4.java because HttpClient changed in Vert.x 4. Use vertx-stack-depchain dependencyManagement, this also manages netty-all, jackson-annotations, jackson-databind.
cf0248d
to
789027b
Compare
@ADarko22 I've rebased the PR. |
if (ASSERTION_METHODS_PATTERN.matcher(methodName).matches()) { | ||
if ("verify".equals(methodName) || "failing".equals(methodName)) { | ||
return !VERTX_TEST_CONTEXT_METHODS.matches(methodSymbol); | ||
} | ||
return true; | ||
} | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly ASSERTION_METHODS_PATTERN.matcher(methodName).matches()
is always true when "verify".equals(methodName) || "failing".equals(methodName)
; then the ogic can be simplified as follows:
if (ASSERTION_METHODS_PATTERN.matcher(methodName).matches()) { | |
if ("verify".equals(methodName) || "failing".equals(methodName)) { | |
return !VERTX_TEST_CONTEXT_METHODS.matches(methodSymbol); | |
} | |
return true; | |
} | |
return false; | |
} | |
if ("verify".equals(methodName) || "failing".equals(methodName)) { | |
return !VERTX_TEST_CONTEXT_METHODS.matches(methodSymbol); | |
} | |
return ASSERTION_METHODS_PATTERN.matcher(methodName).matches(); |
java-checks/src/main/java/org/sonar/java/checks/helpers/UnitTestUtils.java
Show resolved
Hide resolved
@julianladisch thank you! I'm merging your changes in this PR. |
Add these methods of Eclipse Vert.x with JUnit 5 (VertxTestContext)
to list of assertion methods:
Exclude these methods of Eclipse Vert.x with JUnit 5 (VertxTestContext)
from list of assertion methods:
Upgrade Vert.x version from 3.5.4 to 4.3.1. This requires code changes
in VertxJUnit4.java because HttpClient changed in Vert.x 4.
Use vertx-stack-depchain dependencyManagement, this also
manages netty-all, jackson-annotations, jackson-databind.