Migrate remaining JUnit 4 tests to JUnit Jupiter where feasible
In Spring Framework 5.2, we migrated most of the test suite from JUnit 4 to JUnit Jupiter; however, prior to this commit, several tests in the spring-test module were still based on JUnit 4 unnecessarily. Since we are now planning to deprecate our JUnit 4 support in 7.0, this commit migrates our remaining JUnit 4 based tests to JUnit Jupiter whenever feasible. In the process, test classes that previously resided under the "junit4" package have been moved to new packages directly under the "org.springframework.text.context" package, and several classes have been renamed for greater clarity of purpose. Consequently, the only remaining tests based on JUnit 4 are those tests that are required to run with JUnit 4 in order to test our JUnit 4 support. This commit also greatly simplifies exclusions for Checkstyle rules pertaining to JUnit usage. See gh-23451 See gh-34794 Closes gh-34813
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
http://www.springframework.org/schema/jdbc https://www.springframework.org/schema/jdbc/spring-jdbc-4.2.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true">
|
||||
<jdbc:script location="classpath:/org/springframework/test/context/junit4/spr8849/spr8849-schema.sql" />
|
||||
<jdbc:script location="classpath:/org/springframework/test/context/jdbc/enigma-schema.sql" />
|
||||
</jdbc:embedded-database>
|
||||
|
||||
</beans>
|
||||
@@ -6,7 +6,7 @@
|
||||
http://www.springframework.org/schema/jdbc https://www.springframework.org/schema/jdbc/spring-jdbc-4.2.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" database-name="#{T(java.util.UUID).randomUUID().toString()}">
|
||||
<jdbc:script location="classpath:/org/springframework/test/context/junit4/spr8849/spr8849-schema.sql" />
|
||||
<jdbc:script location="classpath:/org/springframework/test/context/jdbc/enigma-schema.sql" />
|
||||
</jdbc:embedded-database>
|
||||
|
||||
</beans>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<mvc:annotation-driven />
|
||||
<mvc:default-servlet-handler />
|
||||
|
||||
</beans>
|
||||
@@ -8,13 +8,13 @@
|
||||
http://www.springframework.org/schema/tx https://www.springframework.org/schema/tx/spring-tx.xsd
|
||||
http://www.springframework.org/schema/jdbc https://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
|
||||
|
||||
<context:component-scan base-package="org.springframework.test.context.junit4.orm"/>
|
||||
<context:component-scan base-package="org/springframework/test/context/orm/hibernate"/>
|
||||
|
||||
<tx:annotation-driven />
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="HSQL">
|
||||
<jdbc:script location="classpath:/org/springframework/test/context/junit4/orm/db-schema.sql"/>
|
||||
<jdbc:script location="classpath:/org/springframework/test/context/junit4/orm/db-test-data.sql"/>
|
||||
<jdbc:script location="classpath:/org/springframework/test/context/orm/hibernate/db-schema.sql"/>
|
||||
<jdbc:script location="classpath:/org/springframework/test/context/orm/hibernate/db-test-data.sql"/>
|
||||
</jdbc:embedded-database>
|
||||
|
||||
<bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"
|
||||
@@ -27,8 +27,8 @@
|
||||
</property>
|
||||
<property name="mappingResources">
|
||||
<list>
|
||||
<value>org/springframework/test/context/junit4/orm/domain/Person.hbm.xml</value>
|
||||
<value>org/springframework/test/context/junit4/orm/domain/DriversLicense.hbm.xml</value>
|
||||
<value>org/springframework/test/context/orm/hibernate/domain/Person.hbm.xml</value>
|
||||
<value>org/springframework/test/context/orm/hibernate/domain/DriversLicense.hbm.xml</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<hibernate-mapping auto-import="true" default-lazy="false">
|
||||
|
||||
<class name="org.springframework.test.context.junit4.orm.domain.DriversLicense" table="drivers_license">
|
||||
<class name="org.springframework.test.context.orm.hibernate.domain.DriversLicense" table="drivers_license">
|
||||
<id name="id" column="id">
|
||||
<generator class="identity" />
|
||||
</id>
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
<hibernate-mapping auto-import="true" default-lazy="false">
|
||||
|
||||
<class name="org.springframework.test.context.junit4.orm.domain.Person" table="person">
|
||||
<class name="org.springframework.test.context.orm.hibernate.domain.Person" table="person">
|
||||
<id name="id" column="id">
|
||||
<generator class="identity" />
|
||||
</id>
|
||||
<property name="name" column="name" />
|
||||
<many-to-one name="driversLicense" class="org.springframework.test.context.junit4.orm.domain.DriversLicense"
|
||||
<many-to-one name="driversLicense" class="org.springframework.test.context.orm.hibernate.domain.DriversLicense"
|
||||
column="drivers_license_id" unique="true" />
|
||||
</class>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:c="http://www.springframework.org/schema/c"
|
||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd">
|
||||
|
||||
<mvc:annotation-driven />
|
||||
<mvc:default-servlet-handler />
|
||||
|
||||
<bean id="foo" class="java.lang.String" c:_="enigma" />
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user