This project demonstrates unit and integration testing for a Spring Boot JPA Repository using JUnit 5, AssertJ, and BDD-style test methods. It covers standard CRUD operations and custom query methods using both JPQL and native SQL.
- Spring Boot + Spring Data JPA
- In-memory H2 database for fast testing
- JUnit 5 with BDD-style method naming
- AssertJ for fluent and readable assertions
- Custom repository queries using:
- JPQL (with index and named parameters)
- Native SQL (with index and named parameters)
✅ Save employee
✅ Get all employees
✅ Get employee by ID
✅ Get employee by email
✅ Update employee
✅ Delete employee
✅ Find by JPQL (index and named parameters)
✅ Find by native SQL (index and named parameters)
springboot-transaction-demo/
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/javaboy/springboot/
│ │ │ ├── controller/
│ │ │ ├── model/
│ │ │ ├── repository/
│ │ │ └── SpringbootTransactionDemoApplication.java
│ │ └── resources/
│ │ ├── application.properties
│ │ └── ...
│ └── test/
│ └── java/
│ └── com/javaboy/springboot/repository/
│ └── EmployeeRepositoryTests.java
├── pom.xml
└── README.md