Instant Mockito : learn how to create stubs, mocks, and spies and verify their behavior using Mockito /
Filled with practical, step-by-step instructions and clear explanations for the most important and useful tasks. This is a standard, tutorial-based guide using plenty of examples for illustration. Instant Mockito is ideal for developers new to unit testing, who are looking to get to know how to crea...
Clasificación: | Libro Electrónico |
---|---|
Autor principal: | |
Formato: | Electrónico eBook |
Idioma: | Inglés |
Publicado: |
Birmingham, UK :
Packt Publishing,
2013.
|
Temas: | |
Acceso en línea: | Texto completo |
Tabla de Contenidos:
- Cover; Copyright; Credits; About the Author; About the Reviewer; www.packtpub.com; packtlib.packtpub.com; Table of Contents; Instant Mockito; So, what is Mockito?; Using Mockito; Integrating Mockito within your existing websites/applications; Installation; Step 1
- what do I need?; Step 2
- attaching JARs to the classpath; And that's it; Quick start
- creating your first unit test with Mockito; Step 1
- picking a class that you want to unit test; Step 2
- picking a method that you want to unit test; Step 3
- creating a unit test class with a properly defined method.
- Step 4
- creating the mocks, and setting them in the object under testStep 5
- defining, executing, and verifying Mock behavior; Top 8 features you need to know about; Performing argument matching; Stubbing multiple calls; Working with void methods and thrown exceptions; Stubbing with a custom answer; Verifying behavior (including argument capturing, verifying call order, and working with asynchronous code); Doing partial mocking (spying); Reducing boilerplate code with annotations; Removing boilerplate by using the MockitoJUnitRunner.
- Removing boilerplate when you can't use the MockitoJUnitRunnerTaking advantage of advanced mocks configuration; Let us be more informative on NullPointerException; Providing additional interfaces; People and places you should get to know; Official sites; Articles and tutorials; Community; Blogs; Twitter.