Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot JPA Repository using JUnit 5, AssertJ, and BDD-style test methods

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.


✅ Features

  • 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)

🔍 Test Coverage

✅ 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)

🧱 Project Structure

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

About

Spring Boot JPA repository testing using JUnit 5, AssertJ, BDD-style methods, and custom JPQL/native SQL queries.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages