Running JUnit4to5Migration does not guarantee that in the future team members will not include Junit4 to the classpath accidently (IDEs are the main one to do so)
In my team, we are adding the following configuration to our build after migrating to Junit 5 to avoid adding it in the future.
This is something that we could consider as part of the migration recipe as well
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>ban-junit-4</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<excludes>
<exclude>junit:junit</exclude>
</excludes>
<message>JUnit 4 is banned from this project in favor of JUnit 5
</message>
</bannedDependencies>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Running
JUnit4to5Migration
does not guarantee that in the future team members will not include Junit4 to the classpath accidently (IDEs are the main one to do so)In my team, we are adding the following configuration to our build after migrating to Junit 5 to avoid adding it in the future.
This is something that we could consider as part of the migration recipe as well