Mockito Junit Interview Question and Answer for fresher and experienced with example | Code Decode

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ก.ย. 2022
  • In this video of code decode we have explained mockito interview questions and answers
    Udemy Course of Code Decode on Microservice k8s AWS CICD link:
    openinapp.co/udemycourse
    Course Description Video :
    yt.openinapp.co/dmjvd
    What is Mockito in JUnit?
    Mockito is a Java-based mocking framework used for unit testing of Java application. Its used in conjunction with other testing frameworks such as JUnit and TestNG. It internally uses Java Reflection API in order to create mock objects for a given interface. Mock objects are nothing but proxy for actual implementations.
    What is Mocking?
    Mocking in mockito is a process of developing the objects that act as the mock or clone of the real objects. In other words, mocking is a testing technique where mock objects are used instead of real objects for testing purposes. Mock objects provide a specific (dummy) output for a particular (dummy) input passed to it.
    Mocking in mockito is used for unit testing is when you create an object that implements the behavior of a real subsystem in controlled ways. In short, mocks are used as a replacement for a dependency.
    To mock objects, you need to understand these key concepts of mocking, i.e., stub, fake, spy, dummy and mock. Some of the unit tests involve only stubs, whereas some involve fake, and mocks.
    A method invoked using mocked reference does not execute the actual method body defined in the class file, rather the method behavior is configured using when(...).thenReturn(...) methods.
    What is @Mock and @InjectMocks?
    In mockito-based junit tests, @Mock annotation creates mocks and @InjectMocks creates actual objects and injects mocked dependencies into it.
    We must define the when(...).thenReturn(...) methods for mock objects whose class methods will be invoked during actual test execution.
    So In a junit test, we create objects for the class which need to be tested and its methods to be invoked using inject mock
    We create mocks for the dependencies which will not be present in the test environment and objects are dependent on it to complete the method call.
    Most Asked Core Java Interview Questions and Answers : • Core Java frequently a...
    Advance Java Interview Questions and Answers : • Advance Java Interview...
    Java 8 Interview Questions and Answers : • Java 8 Interview Quest...
    Hibernate Interview Questions and Answers : • Hibernate Interview Qu...
    Spring Boot Interview Questions and Answers : • Advance Java Interview...
    Angular Playlist : • Angular Course Introdu...
    SQL Playlist : • SQL Interview Question...
    GIT : • GIT
    Subscriber and Follow Code Decode
    Subscriber Code Decode : th-cam.com/users/CodeDecode?...
    LinkedIn : / codedecodeyoutube
    Instagram : / codedecode25
    #mockito #codedecode #junit #javainterviewquestion

ความคิดเห็น • 94

  • @235gurukeerthana5
    @235gurukeerthana5 3 วันที่ผ่านมา +1

    i learned some many things because of your explanation huge fan of you!!!!!. Please create a series for other Junit topics also like spy, fake and dummy etc.. and please create updated technologys full of topics for interviews

  • @bluesibilings2806
    @bluesibilings2806 ปีที่แล้ว +6

    No words to describe for your explanation, became huge fan of you!!!!!🥰. Please create a series for other Junit topics also like spy, fake and dummy etc..

  • @BaluKompalli
    @BaluKompalli ปีที่แล้ว +1

    Great tutorial. I have followed each and every video and have practiced the same flow. Got successful response.

  • @mdshahnawaz5949
    @mdshahnawaz5949 ปีที่แล้ว +2

    It is awsome how you are helping us. Please do release the next part soon ie writing Junit for controller.

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Sure Shahnawaz 👍🙂

  • @manognajoshik8465
    @manognajoshik8465 ปีที่แล้ว +6

    Wonderful!! I am a regular follower of your tutorials. Can you please cover everything related to junit and mockito for all layers?

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว +1

      Sure Manogna 🙂🙂

  • @shilpajagdeesh7156
    @shilpajagdeesh7156 ปีที่แล้ว

    very helpful. great understanding. Please cover all remaining Junit along with controller.

  • @ankitshah4211
    @ankitshah4211 ปีที่แล้ว +1

    Marvellous work you are doing...waiting for next videos eagerly

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Thanks Ankit 🙂👍

  • @KateShubham
    @KateShubham ปีที่แล้ว

    This is quality stuff! Are next parts already there now?? can somebody provide link to next parts?

  • @dileephl2709
    @dileephl2709 ปีที่แล้ว +1

    Your explanation is very good, please do cover the remaining things also. We will support you!!

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Thanks 🙏👍 sure 😊

  • @bhavikjoshi1561
    @bhavikjoshi1561 ปีที่แล้ว +2

    Thanks for hearing my request so sooner than later.. I appreciate it,,😊😊

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Thanks for suggesting Mockito. 👍👍nice suggestion Man 👍👍

  • @lakshmichepeni6903
    @lakshmichepeni6903 ปีที่แล้ว

    Thanks for the video.. could you please make complete video for Mockito including the topics mentioned at the ending of this video

  • @abusufiyanrafey4555
    @abusufiyanrafey4555 ปีที่แล้ว +1

    very helpful..🙂👍Please come soon with other parts..Thanks!!!

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Thanks sure 👍👍🙂🙂

  • @shrutik1863
    @shrutik1863 ปีที่แล้ว +1

    Waiting for next video in series, thanks a lot💐

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      sure Shruti we will upload it soon

  • @rakeshburra7655
    @rakeshburra7655 ปีที่แล้ว

    Thanks very neat explanation, Waiting for next video on Mockito

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Sure we will create it soon

  • @kalavalaharipriya6407
    @kalavalaharipriya6407 ปีที่แล้ว +2

    Nice and good understanding tutorial, please help to cover all the concepts related to JUnit testing

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Sure we will upload soon 👍👍🙂

  • @VVV-xf5vl
    @VVV-xf5vl ปีที่แล้ว +1

    Thanx, do the the rest please. It is a great list of tutorials

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Thanks . Sure👍👍

  • @rakeshkachhadiya
    @rakeshkachhadiya ปีที่แล้ว +1

    Great work again.

  • @raakesh4652
    @raakesh4652 ปีที่แล้ว +1

    These videos are very helpful.... pls cover the remaining topics....

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      sure we will cover it soon

  • @hussainbasha8106
    @hussainbasha8106 ปีที่แล้ว +1

    Thanks for the great session on mockito junit could please cover the remaining parts like controller all those concepts.

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Sure thing!👍👍

  • @swapnilmishra697
    @swapnilmishra697 ปีที่แล้ว +1

    Thanks for this series

  • @RanjitKumar-kb7zt
    @RanjitKumar-kb7zt ปีที่แล้ว +2

    Great explanation. Please cover remaining as well from Junit :)

  • @NIKHILKUMAR-it4nj
    @NIKHILKUMAR-it4nj ปีที่แล้ว +1

    like the way you are explaining mam , waiting for another junit on controller 🙏🙏

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Sure Nikhil 👍👍

  • @pritesh427
    @pritesh427 7 หลายเดือนก่อน +1

    Hi Maam, such a great explanation.!! Can you please upload the third video, covering the test cases for controller class?

    • @CodeDecode
      @CodeDecode  7 หลายเดือนก่อน

      Sure 👍👍

  • @truthreveal6521
    @truthreveal6521 ปีที่แล้ว +2

    How to mock private methods . Plz continue these series

  • @akashsaha9366
    @akashsaha9366 ปีที่แล้ว +2

    Thanks, please make the next video on spy and mockito

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Sure Akash 🙂👍

  • @anandnerurkar2572
    @anandnerurkar2572 8 หลายเดือนก่อน +1

    good one and nice explainaion, pls add for fake ,spy,dummy also

    • @CodeDecode
      @CodeDecode  8 หลายเดือนก่อน

      Sure we will create video on it soon

  • @sanketh768
    @sanketh768 ปีที่แล้ว +2

    Please make a detailed video on other annotations like spy mock, mockbean and other annotations as well.

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว +1

      Sure 🙂🙂

    • @sanketh768
      @sanketh768 ปีที่แล้ว +1

      @@CodeDecode will be waiting for your video

  • @codingmoments
    @codingmoments ปีที่แล้ว +1

    Thnx for this video

  • @snehalakkar9842
    @snehalakkar9842 ปีที่แล้ว +1

    Very good tutorial, pls cover further part of this tutorial and spy

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Sure we will cover it soon

  • @bhavikjoshi1561
    @bhavikjoshi1561 ปีที่แล้ว +3

    please create next part. I will be waiting for it. thanks

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Sure Bhavik 👍👍

  • @AshutoshMohanty07
    @AshutoshMohanty07 ปีที่แล้ว +1

    Thanks for hearing the request. 🙏🙏

  • @sufiyanKhan-wn9wq
    @sufiyanKhan-wn9wq 2 หลายเดือนก่อน +1

    PLEASE MAKE VIDEO ON Controller junit and remaning topics of mockito ....

    • @CodeDecode
      @CodeDecode  หลายเดือนก่อน

      Sure 👍

  • @oldaccount137
    @oldaccount137 ปีที่แล้ว +1

    Very helpful mam please make furthur videos

  • @kiranlulla6540
    @kiranlulla6540 ปีที่แล้ว +1

    Thank you

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Thanks Kiran 😊👍

  • @rishiraj2548
    @rishiraj2548 ปีที่แล้ว

    👍👍

  • @bharukeerthi1986
    @bharukeerthi1986 ปีที่แล้ว +1

    Great .. please cover remaining topics

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      sure we will cover it soon

  • @neha6000
    @neha6000 ปีที่แล้ว +1

    Nice video

  • @virajpatel5859
    @virajpatel5859 ปีที่แล้ว +1

    Nice.

  • @utkarshshukla4505
    @utkarshshukla4505 ปีที่แล้ว +1

    Excellent video mam 👍 , mam can you please cover all

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      sure we will cover it soon

  • @ankitambekar6073
    @ankitambekar6073 ปีที่แล้ว +1

    Hi, please upload a next video of the mockito series.

  • @harshitsachdeva4836
    @harshitsachdeva4836 ปีที่แล้ว

    How to throw checked exception like IOEXception using thenThrow of mockito ?

  • @swarnavakhara7501
    @swarnavakhara7501 ปีที่แล้ว +1

    Please make a video on junit controller class as well

  • @lakshmipriyaalagiyamanaval3059
    @lakshmipriyaalagiyamanaval3059 ปีที่แล้ว +1

    Please create the subsequent part. We are waiting

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Sure LakshmiPriya👍👍

  • @nareshk4880
    @nareshk4880 ปีที่แล้ว

    please do video for rest controlloer junit with mockito

  • @kavithaeswaradoss8970
    @kavithaeswaradoss8970 ปีที่แล้ว

    Pl add a video on doreturn thenreturn controllerjunit tests do nothing etc

  • @velankayalasrinu2190
    @velankayalasrinu2190 ปีที่แล้ว +1

    please do for the controller also

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      sure we will create it soon

  • @ionadsouza1066
    @ionadsouza1066 9 หลายเดือนก่อน +1

    Please make another video

    • @CodeDecode
      @CodeDecode  9 หลายเดือนก่อน

      Sure we will create it soon

  • @prathappoojary8585
    @prathappoojary8585 ปีที่แล้ว +1

    Do the video spy,, dothrows ..ect pls

  • @satyanarayanareddyb3052
    @satyanarayanareddyb3052 ปีที่แล้ว +1

    Please do the controller Junit..

    • @CodeDecode
      @CodeDecode  ปีที่แล้ว

      Sure 👍👍

    • @sarannav365
      @sarannav365 13 ชั่วโมงที่ผ่านมา

      @@CodeDecode can u please provide the link for controller Junit?

  • @shubhamraj5184
    @shubhamraj5184 ปีที่แล้ว

    Where is Controller class Junit

  • @aakashyadav9117
    @aakashyadav9117 ปีที่แล้ว

    only 5 likes remaining for 500

  • @pavanpavankalyan2790
    @pavanpavankalyan2790 ปีที่แล้ว

    how can we write test case for printstacktrace in catch and Logger Messsages (log.isDebugEnabled)