Skip to content

Ban JUnit 4 imports - #296

Merged
timja merged 2 commits into
jenkinsci:masterfrom
strangelookingnerd:patch-1
Aug 20, 2025
Merged

timja merged 2 commits into
jenkinsci:masterfrom
strangelookingnerd:patch-1

Conversation

@strangelookingnerd

Copy link
Copy Markdown
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

@timja timja added the chore label Aug 18, 2025
@strangelookingnerd

Copy link
Copy Markdown
Contributor Author
[2025-08-18T09:16:37.985Z] Rule 0: org.apache.maven.plugins.enforcer.RestrictImports failed with message:
[2025-08-18T09:16:37.985Z] 
[2025-08-18T09:16:37.985Z] Banned imports detected in TEST code:
[2025-08-18T09:16:37.985Z] 
[2025-08-18T09:16:37.985Z] Reason: Use JUnit 5 (org.junit.jupiter.*)
[2025-08-18T09:16:37.986Z] 	in file:///home/jenkins/agent/workspace/Plugins_checks-api-plugin_PR-296/src/test/java/io/jenkins/plugins/checks/ArchitectureTest.java
[2025-08-18T09:16:37.986Z] 		org.junit.runner.RunWith 	(Line: 10, Matched by: org.junit.**)

@strangelookingnerd strangelookingnerd mentioned this pull request Aug 18, 2025
6 tasks
@timja
timja merged commit 3b981b4 into jenkinsci:master Aug 20, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants