CRUD JUnit Tests for Spring Data JPA | Testing Repository Layer | Spring Boot | @DataJpaTest

preview_player
Показать описание
In this video, we will learn how to test repository or DAO layer using Spring boot provided @DataJpaTest annotation.

We will write a JUnit test cases for CRUD operations - Create, Read, Update and Delete.

Table of contents:
⌚[00:00] Intro
⌚[01:44] Create Spring Boot Project
⌚[05:38] Create JPA Entity
⌚[09:30] Create Spring Data JPA Repository
⌚[12:38] Create EmployeeRepositoryTests Class
⌚[13:59] JUnit test for Save Employee
⌚[18:25] JUnit test for Get Employee
⌚[20:34] JUnit test for Get List of Employees
⌚[22:18] JUnit test for Update Employee
⌚[25:11] JUnit test for Delete Employee
⌚[32:15] Ordering JUnit tests
⌚[34:45] Running JUnit tests

#junit #springboot #springdatajpa
Рекомендации по теме
Комментарии
Автор

i have watched your several videos on react integration with spring boot for crud operation and now this video, you are awesome, you deserve 10 x subscriber than this

sanketlondhe
Автор

Good video. Instead of using a Test method to save data in db to use in other test methods, you could use a sql file to load data in in-memory db.

AshishRohillax
Автор

Hey Ramesh bro, can u make a long, fat...Complete junit + mockito videos, with covering major real time scenarios. You've quite smooth flow of teaching.

aadiraj
Автор

Awesome video.
Explanation is on another level.
Somehow, I end up here for solution.
Thanks. Java Guides 🙂

privateuser
Автор

Thanks! this video help me a lot to complete my first testing unit, i cant found a way to create a testing database to check my CRUD and routes! and you answered all at the same time!!!

ivanpassalia
Автор

Awesome video clear all the concepts 👍

shubhamdalvi
Автор

Very simple tutorial with line by line coding 👌

meenajadhav
Автор

Bro Make one video on junit and mockito using all the annotations like real time.

nagvraj
Автор

Please, make video series where you testing all layers in a simple crud application

evgeniyosis
Автор

@JavaGuides Please make more videos on these JUnit Testing with different kinds of apps not just CRUD based apps

Shiva_Codes
Автор

Your Videos are very good please do something for the low sound, I can't hear you clearly.

sarfarazraj
Автор

Hi Bro, Firstly thank you very much for creating wonderful video. If we need test service layer with Junit. How we will do. If possible do the video on this concept plz. Its very useful for everyone.

vndprasadgrandhi
Автор

Good tutorial ❤️🙌
Can you please make a video on junit testing for DynamoDb with controller and service layer code.

parthdeveloper
Автор

Hi Ramesh, Do you have any video on how to use the real database like Oracle, MySQL, PostgresSQL etc
for running test cases instead of using the in-memory database and also can we see the records/transaction(without rollback) in the database tables created by test cases? what configuration is required to do the same ?

gokulaher
Автор

I have a request, can you please cover EntityManager testing with Mockito?

pranavmahajan
Автор

Guys in case you are unable to use builder patters and it says "The method builder() is undefined for the type Employee" please make sure you have the project lombok configured in your working IDE.

kulkarniprabhakar
Автор

Hi, I added lombok dependency. But .builder is not working in employeeRepositoryTests. How to solve ?

vishalr
Автор

bro what is the point of testing the inbuilt jpa methods? if there is any custom method you wrote inside repo that can be tested. all these save, find are tested by the spring team.

mathewsxavier
Автор

Not able to call the lambkok bulder() method in test method

UpThrustt
Автор

Sir please tell difference between @Bean and @Autowired

Gaurav-wywm