Description
Overview
This issue is a follow up to #22932.
The challenge is to define Checkstyle rules that prevent the use of types such as org.junit.Assert
and org.junit.Assume
in src/main/java
while simultaneously allowing their use in src/test/java
.
In addition, the rules cannot be too restrictive since spring-test
actually depends on various JUnit APIs.
If we implement such rules, the implementation may require the introduction of a special checkstyle.xml
file that is only applied to src/main
. Furthermore, we likely should only apply these special rules to spring-test
.
In addition, we may want to ensure that we do not accidentally use improper APIs from JUnit Jupiter and TestNG -- for example, their assertion libraries -- in src/main
for spring-test
.
Deliverables
Introduce Checkstyle rules to prevent improper use of testing/assertion APIs (except where needed in spring-test
).
- JUnit 3:
junit.framework.*
(src/main
andsrc/test
) - JUnit 4:
org.junit.*
(src/main
andsrc/test
) - JUnit Jupiter:
org.junit.jupiter.api.Assertions
andorg.junit.jupiter.api.Assumptions
(src/main
andsrc/test
) - TestNG:
org.testng.*
(src/main
andsrc/test
) - Hamcrest:
org.hamcrest.*
(src/main
andsrc/test
)