Spring Boot Testing | Writing JUnit Tests using JUnit and Mockito | Java Techie

This video will explain you How to write Junit test case using Mockito in spring boot

#JavaTechie #mockito #SpringBoot




Like and subscribe

Similar Posts

48 thoughts on “Spring Boot Testing | Writing JUnit Tests using JUnit and Mockito | Java Techie
  1. Awesome content, pretty straight forward. Some people are complaining about communication. Don't worry about accent/communication as long as your content is good.👍🏻

  2. Thanks for covering Mockito. I believe this is Junit 4. Can you please cover more test cases with Junit 5 and with different situations including how to handle exceptions and all?

  3. on the 2nd test (starting 11:00), the dummy data address is "USA" and we are searching for "Bangalore", why it still come with 1 result? It should be 0 correct?

  4. Nice Video & explanation! Why the GetUserByAddress method is returning 1 i(searching for Bangalore our mocked DB has USA) ? assertEquals should be (1,0) I am new to this Am I missing something Thanks in advance

  5. Hi on line No 51 how you were able to do assertEquals on two objects. I had to override equals method and implement it to do equals as I was getting false because it was just comparing the reference value of those 2 objects.

    Please guide me on this.


  6. Need one help : I need to mock an HttpServletRequest object which will have content type as Multipart.
    The default request mock does not give Multipart so my condition is not getting covered. Please assist

  7. Hi, if you having this warning: "no test found with test runner junit 5", you need to import:

    import org.junit.jupiter.api.Test;

    insted of
    import org.junit.Test;

    Btw: Thanks Java Techie

  8. Can you please explain why @AutoWired was used for UserService, but @MockBean used for UserRepository?


    UserService service;


    UserRepository repository;

  9. Class someClass {
    public void someMethod()
    String str1 = someService.method();
    String str2 = someService2.method2(str1);

    syso( Str2.length() );
    How can i test this if my method is dependent on multiple service..
    And should i use mock or injectMocks?
    Please help

Leave a Reply

Your email address will not be published. Required fields are marked *