Testing with JUnit 5
Test classes are not part of the usual source code folder, src/main/java
. Instead, they are placed in src/test/java
. They can and should be organized into packages. You can also have resources that are just used by the test classes, such as logging.properties
or log4j2.xml
. They will be placed in src/test/resources
.
We will need to add new components to our Maven pom.xml
file. The first is the dependency for JUnit 5. The first addition is the bill of materials (BOM), in a section called dependencyManagement
:
<dependencyManagement> <dependencies> <dependency> <groupId>org.junit</groupId> <artifactId...