Skip to content

Conversation

@strangelookingnerd
Copy link
Contributor

Ban JUnit 4 imports

To prevent regressions when adding new tests, jenkinsci/plugin-pom#1178 introduced a new flag that enables a Maven Enforcer rule banning org.junit.* imports while allowing org.junit.jupiter.*.

With this change, the build will fail if any org.junit.* imports are introduced.

Testing done

None. Rely on ci.jenkins.io.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@strangelookingnerd strangelookingnerd requested a review from a team as a code owner August 15, 2025 12:39
@strangelookingnerd
Copy link
Contributor Author

[2025-08-15T12:42:38.331Z] Rule 0: org.apache.maven.plugins.enforcer.RestrictImports failed with message:
[2025-08-15T12:42:38.331Z] 
[2025-08-15T12:42:38.331Z] Banned imports detected in TEST code:
[2025-08-15T12:42:38.331Z] 
[2025-08-15T12:42:38.331Z] Reason: Use JUnit 5 (org.junit.jupiter.*)
[2025-08-15T12:42:38.331Z] 	in file:///home/jenkins/agent/workspace/Plugins_email-ext-plugin_PR-635/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherTest.java
[2025-08-15T12:42:38.332Z] 		org.junit.ClassRule 	(Line: 64, Matched by: org.junit.**)

Good catch, this Rule can be migrated to JUnit5. I'll post a PR shortly.

@strangelookingnerd strangelookingnerd mentioned this pull request Aug 15, 2025
6 tasks
@slide slide closed this in #636 Aug 15, 2025
@strangelookingnerd
Copy link
Contributor Author

@slide please reopen. PR got auto-closed due to my comment in #636

@slide slide reopened this Aug 15, 2025
@slide
Copy link
Member

slide commented Aug 28, 2025

Can you fix the conflicts?

@strangelookingnerd
Copy link
Contributor Author

Can you fix the conflicts?

There are no conflicts

@slide
Copy link
Member

slide commented Oct 12, 2025

It shows "This branch cannot be rebased due to conflicts"

@slide slide merged commit d6be897 into jenkinsci:main Oct 13, 2025
17 checks passed
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.

2 participants