How to write Junit test for Rest Controllers In Spring boot| MockMvc test

preview_player
Показать описание
Hi Everyone, This video is about writing unit test for the Spring boot based REST controllers. We will be following TDD approach to write Unit test.
In this video we will see following things:

- How controller Unit test are different than Service or other layers [00:10]
- How to Use MockMVC. [01:10]
- How to verify API response status [02:45]
- How to Verify API response using JsonPath. [04:00]
- How to Verify API response using DTO verification. [06:30]
- How to validate the Service level Exception. [07:45]
- How to pass Request body with the POST API call [10:40]
- How to use File to read the content in the API call. [13:30]
- How to validate the Invalid Request [14:20]
Рекомендации по теме
Комментарии
Автор

Hi Sir... your content is appreciable and I'm finding some new/diff way to write Junit test case but I have one suggestion i.e. whenever you are explaining/writing any code/methods/imports you should show it and explain it from which pkg ur importing and what is purpose . if you cover maximum W's then your videos will be super duper...

vivekdeshmukh
Автор

I don't understand mocks.. why to mock a service with a our pojo and assert to the same pojo... what we are achieving with this kind of test cases!

r.sathishrameshbabu
Автор

Hello sir can we connect your contant is awesome. i need help in junit regarding Excel file upload method
Thanks
Akash Tiwari

tiwari_talk_show