Тёмный

Spring Boot Unit Testing With Mockito - Controllers 

Teddy Smith
Подписаться 62 тыс.
Просмотров 36 тыс.
50% 1

Spring Boot Unit Testing - Controllers
Linkedin: / teddy-smith-015ba61a3
Website: www.teddysmith.io
Github: github.com/teddysmithdev

Хобби

Опубликовано:

 

14 ноя 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 21   
@franky3557
@franky3557 10 месяцев назад
Thank you for all the work you put into your videos 🙏❤
@codehustler8582
@codehustler8582 11 месяцев назад
Great explanation
@kacper9948
@kacper9948 Год назад
Great help, thanks for the video!
@TeddySmithDev
@TeddySmithDev Год назад
No prob. Thank you for watching 👍
@DesertCookie
@DesertCookie Год назад
This isn't a unit test though. This is an implementation test, as you are acutally including API calls. A unit test would simply be testing the method on it's own, without using a restful API. Ideally, one should have both unit and integration tests; after all, the unit test might pass as your method works as expected but your integration test might fail due to the path having changed - or an issue the other way around might arise.
@TeddySmithDev
@TeddySmithDev Год назад
I actually agree with this and I've wrote unit test using just the method. I like both ways and the tooling is great in Java to just make the API call like this.
@Andrei-sc2mo
@Andrei-sc2mo 3 месяца назад
Hello! Thank you for video. Can you explain to me, why you use @MockBean instead of @Mock. Why we must to raise the Spring context in these tests ?
@Sucheit
@Sucheit Год назад
does not recognize method content after contenttype and says i need requestbuilder before post? what do i do?
@user-wt8gf2nc4f
@user-wt8gf2nc4f 4 месяца назад
You are a savior man😁
@TheShantanu30
@TheShantanu30 7 месяцев назад
Hi I recently migrated to springboot 3.1.5. When I am modifying my existing test cases the way you have explained, I am getting Failed to load application context. Any suggestions? Thanks
@TeddySmithDev
@TeddySmithDev 7 месяцев назад
difficult to say but most likely conflicting dependencies. You might need to look into making sure dependencies are compatible with your version of spring boot
@SouravDas-dm4dt
@SouravDas-dm4dt Месяц назад
Hi, were you able to solve the issue? If yes, then how?
Месяц назад
Hi! What if the controller has dependencias which depend on a service? How do I simulate that with Mockito? Thanks!
@primegurjar
@primegurjar Месяц назад
you can mock the dependencies as well. for example, in your test file, you can write import org.springframework.boot.test.mock.mockito.MockBean; @MockBean MyService myService;
@choukri9421
@choukri9421 3 месяца назад
Is this still a unit test ? even though you use @Autowired and load the spring context ? Or is it an integration test ?
@TeddySmithDev
@TeddySmithDev 3 месяца назад
I asked myself this same question. Seems almost like both. TBH I liked it way more compared to traditional so I just went with it.
@uyo-obongakpan9623
@uyo-obongakpan9623 8 месяцев назад
Your video is cool but work on the video quality on monitor
@slycreator
@slycreator Год назад
thanks for this video
@TeddySmithDev
@TeddySmithDev Год назад
No prob. Thank you for watching 👍
Далее
Qalpoq - Kichkina tabib (hajviy ko'rsatuv)
30:41
Просмотров 236 тыс.
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Просмотров 5 млн
Отец Проводит Тест с Сыном 😂
00:48
Spring Boot Testing - ** Batteries Included 🔋🔋
41:12
Spring Boot 3 Integration Testing With TestContainers
22:08
World Record Tunnel Glide 🪂
0:19
Просмотров 19 млн
Don´t WASTE FOOD pt.2 🍕
0:19
Просмотров 13 млн
Решила папу порадовать
0:33
Просмотров 12 млн
Quantas vezes os ratinhos caíram?
0:18
Просмотров 34 млн