Skip to content

Pull #17876: Fix PackageObjectFactoryTest before/after annotations#17876

Merged
romani merged 1 commit into
checkstyle:masterfrom
mureinik:PackageObjectFactoryTest-before-after
Oct 7, 2025
Merged

Pull #17876: Fix PackageObjectFactoryTest before/after annotations#17876
romani merged 1 commit into
checkstyle:masterfrom
mureinik:PackageObjectFactoryTest-before-after

Conversation

@mureinik

@mureinik mureinik commented Oct 6, 2025

Copy link
Copy Markdown
Contributor

Follow up on #16500 - since PackageObjectFactoryTest is executed using the JUnit Jupiter teset executor, the org.junit.BeforeClass and org.junit.AfterClass JUnit 4 annotations aren't picked up, and the methods annotated with them are never executed.

This patch follows up on the work done in #16233 and replaces these annotations with org.junit.jupiter.api.BeforeAll and org.junit.jupiter.api.AfterAll, respectively, so that these methods are indeed executed as part of the test lifecycle.

@mureinik mureinik force-pushed the PackageObjectFactoryTest-before-after branch from 5e694cb to b175de1 Compare October 6, 2025 23:24
@romani

romani commented Oct 7, 2025

Copy link
Copy Markdown
Member

Nice catch.

How did you find it?

Please review CI failures, CI must be green.

We probably need to add such imports to forbidden

@romani

romani commented Oct 7, 2025

Copy link
Copy Markdown
Member

Instead of referencing of some old issue.
Make prefix "Pull #17876: ..... " As this some sort new problem. No new issue creation is required, we will reuse Pull.

@mureinik mureinik force-pushed the PackageObjectFactoryTest-before-after branch from b175de1 to fcfe763 Compare October 7, 2025 17:29
@mureinik mureinik changed the title Issue #16233: Fix PackageObjectFactoryTest before/after annotations Pull #17876: Fix PackageObjectFactoryTest before/after annotations Oct 7, 2025
@mureinik

mureinik commented Oct 7, 2025

Copy link
Copy Markdown
Contributor Author

@romani thanks!

re: CI failures - looks like my own stupid mistake. I misread the commit message instructions, and (wrongly!) thought they referred to the commit message subject, not the entire commit message.
CI is running now, hopefuly I got it right this time. CI has passed.

re: marking it with "Pull #17876:" - done.

re: forbidding such imports - it looks like the import-control-test.xml was supposed to do that, let me take a look.

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

Ok to merge if CI pass

@romani

romani commented Oct 7, 2025

Copy link
Copy Markdown
Member

forbidding such imports - it looks like the import-control-test.xml was supposed to do that, let me take a look.

Yes, please. I will be awesome to firbid all old junit classes, I surprised they are still available in class path

@mureinik

mureinik commented Oct 7, 2025

Copy link
Copy Markdown
Contributor Author

forbidding such imports - it looks like the import-control-test.xml was supposed to do that, let me take a look.

Yes, please. I will be awesome to firbid all old junit classes, I surprised they are still available in class path

Looking in to it.
Seems like there are some mistakes in the import-control-test.xml. No rocket science there, but there's some finiky work to fix it. I'll open a separate issue/PR for it.

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

Thanks a lot

@romani romani merged commit 0db059a into checkstyle:master Oct 7, 2025
120 checks passed
@github-actions github-actions Bot added this to the 12.0.0 milestone Oct 7, 2025
@mureinik mureinik deleted the PackageObjectFactoryTest-before-after branch October 7, 2025 20:12
@mureinik

Copy link
Copy Markdown
Contributor Author

Looking in to it. Seems like there are some mistakes in the import-control-test.xml. No rocket science there, but there's some finiky work to fix it. I'll open a separate issue/PR for it.

I take back my assessment of import-control-test.xml. It seems that the main issue isn't that configuration, but the fact that a lot of test classes just suppress the Import Control check.
In any event - I'm working on it.
Will open a PR detailing all the issues I find once I get it sorted out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants