Instant Mockito

Learn how to create stubs, mocks, and spies and verify their behavior using Mockito

Instant Mockito

Starting
Marcin Grzejszczak

Learn how to create stubs, mocks, and spies and verify their behavior using Mockito
$12.99
RRP $12.99
eBook

Get unlimited access to this and 3,500 other courses today!

With unlimited access to a constantly growing library of over 3,500 courses, a subscription to Mapt gives you everything you need to get that next promotion or to land that dream job. Cancel anytime.

+ Collection
Free Sample

Book Details

ISBN 139781782167976
Paperback66 pages

Book Description

Mockito is an open source testing framework for Java that automates unit tests for use in test-driven development (TDD) or behavior-driven development (BDD), decoupling test code from the system under test by eliminating the expect-run-verify pattern. It lets you write beautiful tests with a clean and simple API.

Instant Mockito contains plenty of real-life examples on how to unit test your code. It shows you how to use this testing framework and explains best practices on how to use it effectively.

Instant Mockito helps you break each significant method into a set of practical examples. It will clarify all the concepts of unit testing and Mockito.

You will learn how to properly capture and verify arguments passed into your stubbed methods. We will also take a look at verifying an order and returning custom answers on the stubs. If you want to take advantage of using the Mockito framework’s API to tame your code base, then this is the book for you.

You will learn everything you need to know to unit test your code in a clear, readable, and high quality manner.

Table of Contents

Chapter 1: Instant Mockito
So, what is Mockito?
Installation
Quick start – creating your first unit test with Mockito
Top 8 features you need to know about
People and places you should get to know

What You Will Learn

  • Create stubs, mocks, and spies
  • Perform argument matching
  • Work with void methods and thrown exceptions
  • Perform stubbing with a custom answer
  • Verify the behaviour of mocks
  • Perform argument capturing
  • Verify the call order
  • Work with asynchronous code
  • Learn about partial mocking
  • Reduce boilerplate code with annotations
  • Learn about advanced mock configuration

Authors

Table of Contents

Chapter 1: Instant Mockito
So, what is Mockito?
Installation
Quick start – creating your first unit test with Mockito
Top 8 features you need to know about
People and places you should get to know

Book Details

ISBN 139781782167976
Paperback66 pages
Read More

Read More Reviews