Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
MOCKITO COOKBOOK

You're reading from   MOCKITO COOKBOOK Over 65 recipes to get you up and running with unit testing using Mockito.

Arrow left icon
Product type Paperback
Published in Jun 2014
Publisher
ISBN-13 9781783982745
Length 284 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Marcin Grzejszczak Marcin Grzejszczak
Author Profile Icon Marcin Grzejszczak
Marcin Grzejszczak
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Getting Started with Mockito FREE CHAPTER 2. Creating Mocks 3. Creating Spies and Partial Mocks 4. Stubbing Behavior of Mocks 5. Stubbing Behavior of Spies 6. Verifying Test Doubles 7. Verifying Behavior with Object Matchers 8. Refactoring with Mockito 9. Integration Testing with Mockito and DI Frameworks 10. Mocking Libraries Comparison Index

Preface

According to Google Trends, Mockito, compared to its main Java mocking framework competitors, EasyMock and jMock, has been the most widely used since 2011 and this trend has been upward ever since. Given its extremely simple and elegant API, Mockito gives you the possibility to test your application in a readable manner. Furthermore, it's syntax is so intuitive that you'll learn it in no time at all.

The very concept behind this book is to give the reader the possibility to use Mockito in order to write beautiful and comprehensive tests. The Mockito documentation as such is of very high quality, so you should always, regardless of the tool you are using, refer to it when in doubt. This book is an extension to this documentation since it covers its content but puts it in a real-life example. Where the Mockito documentation proves that the library, as such, is doing what it is supposed to do, you can come to a point where you don't actually know how to use it versus your production code. Worry not! Mockito Cookbook comes to the rescue. This book contains solutions to more than 60 problems that you may encounter throughout your Mockito testing endeavor. You will learn how to write tests that become the living documentation of your code. You will become A Mockito expert. (Since the book also explains some Mockito internals you might even be tempted to become its contributor!) And hopefully, your tests will become an example to be followed by your colleagues.

lock icon The rest of the chapter is locked
Next Section arrow right
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image