Home » Minibooks » Mockito Programming Cookbook

Mockito Programming Cookbook

About the author

JCGs (Java Code Geeks) is an independent online community focused on creating the ultimate Java to Java developers resource center; targeted at the technical architect, technical team lead (senior developer), project manager and junior developers alike.

JCGs serve the Java, SOA, Agile and Telecom communities with daily news written by domain experts, articles, tutorials, reviews, announcements, code snippets and open source projects.

You can find them online at https://www.javacodegeeks.com/

Mockito is an open source testing framework for Java released under the MIT License. The framework allows the creation of test double objects (mock objects) in automated unit tests for the purpose of Test-driven Development (TDD) or Behavior Driven Development (BDD).

In software development there is an opportunity of ensuring that objects perform the behaviors that are expected of them. One approach is to create a test automation framework that actually exercises each of those behaviors and verifies that it performs as expected, even after it is changed. Developers have created mock testing frameworks. These effectively fake some external dependencies so that the object being tested has a consistent interaction with its outside dependencies. Mockito intends to streamline the delivery of these external dependencies that are not subjects of the test. A study performed in 2013 on 10,000 GitHub projects found that Mockito is the 9th most popular Java library. (Source)

In this ebook, we provide a compilation of Mockito programming examples that will help you kick-start your own web projects. We cover a wide range of topics, from initialization and simple test cases, to integration with JUnit, Maven and other frameworks. With our straightforward tutorials, you will be able to get your own projects up and running in minimum time.


Please login to access this download.

Mockito Programming Cookbook includes:

  1. Mockito Tutorial for Beginners
  2. Test-Driven DevelopmentWith Mockito
  3. Mockito Initmocks Example
  4. Mockito Maven Dependency Example
  5. Writing JUnit Test Cases Using Mockito
  6. Mockito: How to mock void method call
  7. Spring Test Mock Example
  8. Mockito Captor Example
  9. Mockito ThenReturn Example
JCG eBooks are professionally designed, downloadable collections of popular JCG content – articles, interviews, presentations, and research – covering the latest software development technologies, trends, and topics.
(0 rating, 0 votes)
You need to be a registered member to rate this.
Comments Off on Mockito Programming Cookbook Views Tweet it!
Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
I agree to the Terms and Privacy Policy