Skip to content
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

Closed

Conversation

julianladisch
Copy link
Contributor

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

@johann-beleites-sonarsource
Copy link
Contributor

Tracked in SONARJAVA-4413

@johann-beleites-sonarsource johann-beleites-sonarsource changed the title Vert.x methods for JUnit5 in AssertionsInTestsCheck SONARJAVA-4413 Vert.x methods for JUnit5 in AssertionsInTestsCheck Feb 9, 2023
@johann-beleites-sonarsource johann-beleites-sonarsource removed their request for review February 9, 2023 10:48
@ADarko22
Copy link
Contributor

@julianladisch, thanks for your PR; it looks nice! Could you please rebase it on master and resolve the conflicts? Most conflicts come from splitting the java-checks-test-sources module into submodules: you may need to add the required dependencies in the java-checks-test-sources/default submodule.

Once you solve those conflicts, I will merge your changes.

Copy link
Contributor

@ADarko22 ADarko22 left a 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.
@julianladisch
Copy link
Contributor Author

@ADarko22 I've rebased the PR.

Comment on lines +220 to +228
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;
}
Copy link
Contributor

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:

Suggested change
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();

@ADarko22
Copy link
Contributor

ADarko22 commented Jan 19, 2024

@ADarko22 I've rebased the PR.

@julianladisch thank you! I'm merging your changes in this PR.

@ADarko22 ADarko22 closed this Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants