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

  Рет қаралды 101,857

Teddy Smith

Teddy Smith

Күн бұрын

Пікірлер: 40
@tejeswar
@tejeswar Жыл бұрын
Most underrated channel, the vast of many tutorial channels in youtube.
@Lykkos-321
@Lykkos-321 2 ай бұрын
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!!
@carrotblog1746
@carrotblog1746 Ай бұрын
Thank you so much I don't know where to start till I found you.
@house_d2024
@house_d2024 Жыл бұрын
Teddy you helped me a lot ! May God bless you
@TeddySmithDev
@TeddySmithDev Жыл бұрын
🙏
@siddharthvinze1276
@siddharthvinze1276 2 ай бұрын
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.
@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.
@shouvikxiv
@shouvikxiv 9 ай бұрын
Loved it. We need more pee examples.
@TeddySmithDev
@TeddySmithDev 9 ай бұрын
i real life loled
@nintendu64
@nintendu64 Жыл бұрын
Real men test in production
@TeddySmithDev
@TeddySmithDev Жыл бұрын
All day
@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 5 ай бұрын
Provided that your test case has validated all business requirements and handled all edge cases. Then yes.
@RohitKumar-dz8dh
@RohitKumar-dz8dh 2 ай бұрын
Do we need to configure our H2 database by removing other database configuration for repository test case?
@TrungRichie
@TrungRichie 9 ай бұрын
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.
@smritagarg
@smritagarg 4 ай бұрын
Why is the entity class is not identified in the reposoitory test class
@JonathanBrooks-k6l
@JonathanBrooks-k6l Ай бұрын
I run DDD, disaster driven development
@Camupof
@Camupof 8 ай бұрын
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 8 ай бұрын
If I remember correctly, this same warning occurred in my terminal. If this isn’t for production app, I’d just let it go.
@Lavless12
@Lavless12 7 ай бұрын
Isn't Arrange Act Assert affiliated with TDD and Given When Then with BDD?
@jasongoossens
@jasongoossens 7 ай бұрын
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 7 ай бұрын
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.
@ShubhamSingh-xu3bo
@ShubhamSingh-xu3bo Жыл бұрын
Could you please suggest any documentation why you have used @mockBean in ControllerTest and @Mock in service
@TeddySmithDev
@TeddySmithDev Жыл бұрын
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.
@jackbaker995
@jackbaker995 7 ай бұрын
the bladder example, lmao
@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
@woistdasniveau8290
@woistdasniveau8290 Жыл бұрын
Does this also work if i use MySql as the Database in the main package?
@RohitKumar-dz8dh
@RohitKumar-dz8dh 2 ай бұрын
While using H2 for test case i am getting error of tables not found. Anyone has solved this then please help 😊.
@МаксимЯрема-е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
@erengunduzvar
@erengunduzvar 3 ай бұрын
Which tool do you use for drawing schemes ? It's doesnt look like draw io or Excali.
@TeddySmithDev
@TeddySmithDev 3 ай бұрын
Microsoft whiteboard
@erengunduzvar
@erengunduzvar 3 ай бұрын
@@TeddySmithDev Thx a lot great content 🙏
@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 8 ай бұрын
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 8 ай бұрын
You probably have a dependency injection issue. Make sure everything auto wired correct.
Spring Boot Unit Testing With Mockito - Repository [Part 1]
9:44
ТЕСТИРОВАНИЕ НА JAVA (JUNIT, MOCKITO)
9:14
Джавист
Рет қаралды 35 М.
小路飞还不知道他把路飞给擦没有了 #路飞#海贼王
00:32
路飞与唐舞桐
Рет қаралды 80 МЛН
Каха и лужа  #непосредственнокаха
00:15
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 20 МЛН
Happy birthday to you by Secret Vlog
00:12
Secret Vlog
Рет қаралды 6 МЛН
Software Testing with Spring boot and Mockito Framework
1:14:12
Bouali Ali
Рет қаралды 34 М.
Spring Boot testing: Zero to Hero by Daniel Garnier-Moiroux
2:42:32
Spring Boot Unit Testing With Mockito - Mocking Explained
15:30
Teddy Smith
Рет қаралды 32 М.
Java Unit Testing with JUnit - Tutorial - How to Create And Use Unit Tests
21:35
Test Driven Development (TDD) in Spring
51:09
Dan Vega
Рет қаралды 28 М.
Mockito Tutorial - Mocking With Junit and Maven
1:11:53
in28minutes
Рет қаралды 552 М.
Unit Testing in Spring Boot with JUnit 5 and Mockito | Part 1
30:37
小路飞还不知道他把路飞给擦没有了 #路飞#海贼王
00:32
路飞与唐舞桐
Рет қаралды 80 МЛН