Spring Boot Unit Testing With Mockito - 1. First Unit Test

  Рет қаралды 108,498

Teddy Smith

Teddy Smith

Күн бұрын

Пікірлер
@Lykkos-321
@Lykkos-321 3 ай бұрын
I'm taking this course in a chill mood without anxiety because is from Teddy Smith, and I know I will ending up understanding all of it without any kind of stress, your previous tutorial of Spring Security helped me a lot!!
@tejeswar
@tejeswar Жыл бұрын
Most underrated channel, the vast of many tutorial channels in youtube.
@house_d2024
@house_d2024 Жыл бұрын
Teddy you helped me a lot ! May God bless you
@TeddySmithDev
@TeddySmithDev Жыл бұрын
🙏
@TeddySmithDev
@TeddySmithDev 2 жыл бұрын
Just wanted to add this in case you a newer developer that does not feel comfortable using git to time travel back before I wrote unit tests. Feel free to clone project and just delete Controller, Service, and Repository folders inside Test to follow along.
@carrotblog1746
@carrotblog1746 2 ай бұрын
Thank you so much I don't know where to start till I found you.
@siddharthvinze1276
@siddharthvinze1276 4 ай бұрын
I was struggling to write test cases in junit. After watching your videos, it's a cake walk. Thanks a lot, you're really a great teacher.
@paulallen4622
@paulallen4622 Жыл бұрын
If you are following TDD, should you write the tests out first before writing the code? Then change the code to pass the test as opposed to changing the test itself?
@ijazhaider6072
@ijazhaider6072 7 ай бұрын
Provided that your test case has validated all business requirements and handled all edge cases. Then yes.
@TrungRichie
@TrungRichie 11 ай бұрын
Can you help me to solve this problems: - When I used 2 annotations the same as you: @DataJpaTest and @AutoConfigureTestDatabase, I got an error: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource. And I can't find any ways to fix it. - When I changed it to @SpringBootTest, everything works fine. Thank you for your help and answers.
@jasongoossens
@jasongoossens 9 ай бұрын
Honest question: why are you testing JPARepository methods? Unless you have custom code in your repo's, wouldn't you skip that, and focus on the service and controller layers? (I assume you're mostly using the automagic methods, and not JPQL, or native SQL)
@TeddySmithDev
@TeddySmithDev 9 ай бұрын
Yeah testing repository is overkill. But I notice that people are googling those keywords so need to include them from SEO standpoint. In real life I would concentrate all the tests in service + controller layer.
@shouvikxiv
@shouvikxiv 10 ай бұрын
Loved it. We need more pee examples.
@TeddySmithDev
@TeddySmithDev 10 ай бұрын
i real life loled
@smritagarg
@smritagarg 6 ай бұрын
Why is the entity class is not identified in the reposoitory test class
@RohitKumar-dz8dh
@RohitKumar-dz8dh 3 ай бұрын
Do we need to configure our H2 database by removing other database configuration for repository test case?
@Camupof
@Camupof 10 ай бұрын
Thank you very much for your video. My tests are passing, but I'm getting the following warning: "Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended." While some sources say this is a non-critical error if the tests pass, others suggest otherwise. Should I be concerned?
@TeddySmithDev
@TeddySmithDev 10 ай бұрын
If I remember correctly, this same warning occurred in my terminal. If this isn’t for production app, I’d just let it go.
@ShubhamSingh-xu3bo
@ShubhamSingh-xu3bo 2 жыл бұрын
Could you please suggest any documentation why you have used @mockBean in ControllerTest and @Mock in service
@TeddySmithDev
@TeddySmithDev 2 жыл бұрын
javarevisited.blogspot.com/2022/08/difference-between-mock-and-mockbean-in.html#axzz7msbBSJ6G The differences are very unclear and documentation is poor. My interpretation is that @MockBean provides Application Context, but I'm curious to those that think different.
@erengunduzvar
@erengunduzvar 4 ай бұрын
Which tool do you use for drawing schemes ? It's doesnt look like draw io or Excali.
@TeddySmithDev
@TeddySmithDev 4 ай бұрын
Microsoft whiteboard
@erengunduzvar
@erengunduzvar 4 ай бұрын
@@TeddySmithDev Thx a lot great content 🙏
@Lavless12
@Lavless12 8 ай бұрын
Isn't Arrange Act Assert affiliated with TDD and Given When Then with BDD?
@theodulesaintil5725
@theodulesaintil5725 Жыл бұрын
Hi Teddy, good job and thank you for the tutorial, but i can not use the builder method in the PokemonRepositoryTests class even i added the @Builder in the pokemon model. do you have any explanation?
@TeddySmithDev
@TeddySmithDev Жыл бұрын
Lombok installed? and you may need to install Lombok IntelliJ add on (sometimes it comes pre installed)
@theodulesaintil5725
@theodulesaintil5725 Жыл бұрын
@@TeddySmithDev first of all i am using Spring Tool Suite as IDE. and yes i have added the lombok dependency in my pom.xml and import the lombok.Builder in the Pokemon model. is there another step to complete?
@KrscanskaApologetika
@KrscanskaApologetika Жыл бұрын
@@theodulesaintil5725 Lombok never worked for me too, I lost days trying to make it work, after exhausting all the possible options I don't use it anymore
@МаксимЯрема-е8щ
@МаксимЯрема-е8щ Жыл бұрын
Thanks for the tutorial. I noticed that the junit dependency is already present in the spring-boot-starter-test, so I guess there's no point in adding it again, right?
@alpersener4269
@alpersener4269 Жыл бұрын
yes
@woistdasniveau8290
@woistdasniveau8290 Жыл бұрын
Does this also work if i use MySql as the Database in the main package?
@RohitKumar-dz8dh
@RohitKumar-dz8dh 3 ай бұрын
While using H2 for test case i am getting error of tables not found. Anyone has solved this then please help 😊.
@jackbaker995
@jackbaker995 9 ай бұрын
the bladder example, lmao
@JonathanBrooks-k6l
@JonathanBrooks-k6l 2 ай бұрын
I run DDD, disaster driven development
@sneak9407
@sneak9407 Ай бұрын
You sir, are a D... diabolical 😂
@chanprakash252
@chanprakash252 Жыл бұрын
Dude, say what you type, helps us follow along better.
@yesno5286
@yesno5286 Жыл бұрын
This topic should be a strand alone topic, and should be baby steps, i have a total of 45 min experience with testing and i cant follow along.
@NourWanis-b5x
@NourWanis-b5x 10 ай бұрын
hello teddy , i have this problem : java.lang.NullPointerException: Cannot invoke "com.example1.pro.repository.GarageRepo.save(Object)" because "this.garageRepo" is null Can you please help me..
@TeddySmithDev
@TeddySmithDev 10 ай бұрын
You probably have a dependency injection issue. Make sure everything auto wired correct.
Spring Boot Unit Testing With Mockito - Repository [Part 1]
9:44
Spring Boot testing: Zero to Hero by Daniel Garnier-Moiroux
2:42:32
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
Software Testing with Spring boot and Mockito Framework
1:14:12
Bouali Ali
Рет қаралды 37 М.
ТЕСТИРОВАНИЕ НА JAVA (JUNIT, MOCKITO)
9:14
Джавист
Рет қаралды 37 М.
Mock, When and ThenReturn with Mockito - JUnit Tutorial
10:46
Aneesh Mistry
Рет қаралды 78 М.
Unit Testing in Spring Boot with JUnit 5 and Mockito | Part 1
30:37
JUnit 5 with Mocking Workshop | Online Training | Ashok IT
3:52:00
Java Unit Testing with JUnit - Tutorial - How to Create And Use Unit Tests
21:35
Advanced Spring Boot Restful APIs Tutorial: Build a Full Spring Boot Web App
1:25:06
The Joy of Testing by Victor Rentea
2:45:36
Devoxx
Рет қаралды 10 М.