Test Setup
We'll put our JUnit test cases in the same package (com.example.jpavideostore.entities) as the entity classes they test.
They'll be in a different source folder, src/test/java, so Gradle knows not to include them in deployment.
When tests run, Hibernate will want a logging configuration file, log4j.properties.
Drill¶
If you haven't already, copy
log4j.propertiesfrom src/main/resources to src/test/resources.
- In the copy, change
log4j.logger.org.hibernate.typefromtracetoWARN.Inside of src/test/java create a package named
com.example.jpavideostore.entities.JPAVideoStore ├── src/main/java │ ├── com.example.jpavideostore.client │ │ ├── AddressClient.java │ │ ├── CustomerClient.java │ │ └── ... │ └── com.example.jpavideostore.entities │ ├── Address.java │ ├── Customer.java │ └── ... ├── src/main/resources │ ├── META-INF │ │ └── persistence.xml │ └── log4j.properties ├── src/test/java │ └── com.example.jpavideostore.entities │ ├── AddressTest.java │ └── CustomerTest.java ├── src/test/resources └── log4j.properties