November 2024
Intermediate to advanced
300 pages
7h 12m
English
The QuestionRepository class talks to an H2 database using the Java Persistence API (JPA). You might correctly guess that this data class is used in many places throughout the application and that testing each of those places will require the use of a test double.
Here’s the code for the class:
| | import iloveyouboss.domain.BooleanQuestion; |
| | import iloveyouboss.domain.PercentileQuestion; |
| | import iloveyouboss.domain.Persistable; |
| | import iloveyouboss.domain.Question; |
| | import jakarta.persistence.EntityManager; |
| | import jakarta.persistence.EntityManagerFactory; |
| | import jakarta.persistence.Persistence; |
| | |
| | import ... |
Read now
Unlock full access