Sunday, October 18, 2015

Mock it i.e. Mockito

What is Mockito ?
Now a days, we are running in sprints. Someone is having shorter sprint ( 1 week… why they call it Sprint, rename it to slow run) and someone is having longer Sprint ( 3-4 weeks, ha ha… what do you thought, will they allow you to slow walk).
Gone are the days when developer has to wait for BRD to get completed and he will get time to analyze it and then start writing code with all interaction also well defined. In the world of sprint you have to shed your weight daily and have to make sure that it will be not having impact on your health as well.
Means two things to take care
1.   Shed the weight ( produce some result daily)
2.   Make sure it is sustainable daily.
To make sure it works, we have to test it daily for its sustainability for whole sprint, but how?
We are still waiting for
1.   wheat to be grinded ( network connectivity)
2.   vegetables to be chosen ( database connectivity )
3.   Recipe to be decided ( Team members classes )
Than few wise men, will start saying ‘why not you are assuming/Predicting something, and start sprinting as whole interaction is cooperative, the person who is sprinting behind you has also assumed a lot about you.’
This saying of the wise man, can be summed up in the single sentence –
“please mock all the persons, objects or whatever you require. Predict their behavior and that is the MOCKITO”
Mockito not only allows you to mock the java class, predict its method behavior, it will even allow you to decide what it should do (in mocking world), instead of what it is doing in real world.
Mockito is the third party tool, which can be easily used to assume or predict the behavior of interacting code.
Mockito has many features let’s start with few:

No comments: