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

Issue #11446: Update SuppressionCommentFilterTest to use verifyWithIn… #11503

Merged
merged 1 commit into from
Apr 3, 2022
Merged

Issue #11446: Update SuppressionCommentFilterTest to use verifyWithIn… #11503

merged 1 commit into from
Apr 3, 2022

Conversation

Rahulkhinchi03
Copy link
Contributor

Resolves update for SuppressionCommentFilterTest in #11446.

Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

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

items for both tests:

illegalClassNames = (default)Error, Exception, RuntimeException, Throwable, java.lang.Error, \
java.lang.Exception, java.lang.RuntimeException, java.lang.Throwable


Copy link
Member

Choose a reason for hiding this comment

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

whole content of this file is not relevant, please remove header comment, and whole body of class.
there should be only empty class.
As we do not use violation of this class.

Apply the same to another Input file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed all the header/comments except Filter config as, without it, the exception is expected and the exception wasn't getting caught.

Copy link
Member

@romani romani Apr 3, 2022

Choose a reason for hiding this comment

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

please investigate a problem.
you use execute(treeWalkerConfig so it means that you get config created in test method (not a Input file).
execute method does not parse Input file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to remove all the comments from the filter config and found that:

/*
SuppressionCommentFilter
offCommentFormat = (default)CHECKSTYLE:OFF
onCommentFormat = (default)CHECKSTYLE:ON


*/

With the above comments, the tests were passing but after removing offCommentFormat = (default)CHECKSTYLE:OFF and onCommentFormat = (default)CHECKSTYLE:ON the test gets fail and asked for the exception is expected.

Copy link
Member

Choose a reason for hiding this comment

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

I updated code to make it work, you need debug code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes Done. I got it.

@romani romani self-assigned this Apr 3, 2022
@romani romani merged commit fb7459a into checkstyle:master Apr 3, 2022
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.

None yet

2 participants