Skip to content

Issue #17924: Enable CheckstyleAntTaskTest.testNoFileOrPathSpecified by making it non-static#17925

Merged
romani merged 1 commit into
checkstyle:masterfrom
mureinik:17924-testNoFileOrPathSpecified-non-static
Oct 15, 2025
Merged

Issue #17924: Enable CheckstyleAntTaskTest.testNoFileOrPathSpecified by making it non-static#17925
romani merged 1 commit into
checkstyle:masterfrom
mureinik:17924-testNoFileOrPathSpecified-non-static

Conversation

@mureinik

@mureinik mureinik commented Oct 13, 2025

Copy link
Copy Markdown
Contributor

JUnit Jupiter does not execute static methods annotated with @Test, as seen in, e.g., https://dev.azure.com/romanivanovjr/romanivanovjr/_build/results?buildId=32943&view=logs&j=c902ebb4-c9f8-5f09-4e17-ff78fbbc842e&t=9ca98c81-ff64-58f0-9d03-a23ac1c4a111&l=116:

(1) [WARNING] @Test method 'public static void com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTaskTest.testNoFileOrPathSpecified()' must not be static. It will not be executed.
    Source: MethodSource [className = 'com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTaskTest', methodName = 'testNoFileOrPathSpecified', methodParameterTypes = '']
            at com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTaskTest.testNoFileOrPathSpecified(SourceFile:0)

This PR fixes the issue by removing the static modifier from that test.

Fixes #17924

@mureinik mureinik force-pushed the 17924-testNoFileOrPathSpecified-non-static branch from 4e66a1d to 1185e87 Compare October 13, 2025 11:25
@mureinik mureinik changed the title Issue #17924: Fix CheckstyleAntTaskTest.testNoFileOrPathSpecified by making it non-static Issue #17924: Enable CheckstyleAntTaskTest.testNoFileOrPathSpecified by making it non-static Oct 13, 2025
@mureinik mureinik force-pushed the 17924-testNoFileOrPathSpecified-non-static branch from 1185e87 to 6a457f4 Compare October 14, 2025 11:10
@mureinik

mureinik commented Oct 14, 2025

Copy link
Copy Markdown
Contributor Author

The "Check no closed issue references" CI failure is unrelated to this RR.
As explained by #17933, an old issue has been closed without updating/removing the links in the codebase, and now this CI check is failing.

Once #17931 (or some reviewed/edited version of it) is merged, this PR should be rebased on top of it so that the CI can pass.

@mureinik mureinik force-pushed the 17924-testNoFileOrPathSpecified-non-static branch from 6a457f4 to f3ab224 Compare October 14, 2025 15:27
@mureinik mureinik force-pushed the 17924-testNoFileOrPathSpecified-non-static branch from f3ab224 to 7f5395c Compare October 14, 2025 15:41
@mureinik

Copy link
Copy Markdown
Contributor Author

After rebasing on top of #17931, CI passes.
This PR is now ready for review (and merging, if the review has no comments)

@romani

romani commented Oct 15, 2025

Copy link
Copy Markdown
Member

https://dev.azure.com/romanivanovjr/romanivanovjr/_build/results?buildId=32993&view=logs&j=c902ebb4-c9f8-5f09-4e17-ff78fbbc842e&t=9ca98c81-ff64-58f0-9d03-a23ac1c4a111&l=104

different warnings:

[INFO] --- surefire:3.5.4:test (default-test) @ checkstyle ---
[INFO] Surefire report directory: /home/vsts/work/1/s/target/surefire-reports
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Running com.puppycrawl.tools.checkstyle.api.FileContentsTest
[INFO] Tests run: 23, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.192 s -- in com.puppycrawl.tools.checkstyle.api.FileContentsTest
[INFO] Running com.puppycrawl.tools.checkstyle.api.FileTextTest
[INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.166 s -- in com.puppycrawl.tools.checkstyle.api.FileTextTest
[INFO] Running com.puppycrawl.tools.checkstyle.api.AbstractViolationReporterTest
[INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.045 s -- in com.puppycrawl.tools.checkstyle.api.AbstractViolationReporterTest
[INFO] Running com.puppycrawl.tools.checkstyle.api.FileSetCheckTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.313 s -- in com.puppycrawl.tools.checkstyle.api.FileSetCheckTest
[INFO] Running com.puppycrawl.tools.checkstyle.api.LineColumnTest
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
WARNING: A Java agent has been loaded dynamically (/home/vsts/work/1/.m2/repository/net/bytebuddy/byte-buddy-agent/1.14.11/byte-buddy-agent-1.14.11.jar)
WARNING: If a serviceability tool is in use, please run with -XX:+EnableDynamicAgentLoading to hide this warning
WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information
WARNING: Dynamic loading of agents will be disallowed by default in a future release

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanksa lot !

@romani romani merged commit b9b61b1 into checkstyle:master Oct 15, 2025
120 checks passed
@mureinik mureinik deleted the 17924-testNoFileOrPathSpecified-non-static branch October 15, 2025 12:59
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.

CheckstyleAntTaskTest.testNoFileOrPathSpecified not executed because it's static

2 participants