What is Unit Test & Mockito & PowerMockito


What is Unit testing?
As a developer you want to know your codes are working perfectly atleast for positive scenarios. To check that developer has to do unit testing.
     As a developer you cannot test all the functionality which other system provides.
For example:If you are calling the service of other system which may impact the database level. So in the unit testing code you cannot call the service everytime. It is very expensive.
So to avoid that we are just stub some success response from other system response. It means response hardcoded. So that we can test all our codes.

What is Mockito?
Instead of stub some dummy response using dummy class. Mock class provide all that for us. We can mock any class or interfaces.


What is PowerMockito?
Mockito is not providing us to mock private fields, methods and constructors.
But using PowerMockito we can achieve that as well.

Comments

Popular posts from this blog

How to set Java Object into JaxBElement ?

GitLab