Java Testing Part 2: Mocks, Stubs, and Spies with Mockito 4

Originally aired:

About the Session

The Mockito framework is the most popular library for creating mocks, stubs, and spies for your tests. This talk reviews why and how you might want to do that, including unit vs integration tests, creating your own mocks and stubs, setting expectations, and verifying the results.

The Mockito documentation is notoriously misleading if you don't already know the principles behind the library. This talk gives an example that hopefully clears up any confusion and makes the docs useful. Many examples will be provided covering a wide range of capabilities. In addition to the basics, issues like mocking static methods, mocking final methods and classes, using spies for existing classes, and more will be examined.

See Highlights

Hear What Attendees Say


“Once again Saltmarch has knocked it out of the park with interesting speakers, engaging content and challenging ideas. No jetlag fog at all, which counts for how interesting the whole thing was."

Cybersecurity Lead, PwC


“Very much looking forward to next year. I will be keeping my eye out for the date so I can make sure I lock it in my calendar."

Software Engineering Specialist, Intuit


“Best conference I have ever been to with lots of insights and information on next generation technologies and those that are the need of the hour."

Software Architect, GroupOn

Hear What Speakers & Sponsors Say

Scott Davis

“Happy to meet everyone who came from near and far. Glad to know you've discovered some great lessons here, and glad you joined us for all the discoveries great and small."

Web Architect & Principal Engineer, Scott Davis

Dr. Venkat Subramaniam

“Wonderful set of conferences, well organized, fantastic speakers, and an amazingly interactive set of audience. Thanks for having me at the events!"

Founder of Agile Developer Inc., Dr. Venkat Subramaniam

Oracle Corp.

“What a buzz! The events have been instrumental in bringing the whole software community together. There has been something for everyone from developers to architects to business to vendors. Thanks everyone!"

Voltaire Yap, Global Events Manager, Oracle Corp.