Book description
Learn all you need to know about the Spring Framework and how to unit test your projects with Mockito
In Detail
Mockito is a testing framework that creates external dependencies; this process is called mocking. This book will provide you with the skills you need to successfully build and maintain meaningful unit and integration test cases for Spring Framework code. This book starts with a brief introduction to the Spring Framework, including its components and architecture.
Packed with real-world examples, the book covers how to make Spring code testable and mock container and external dependencies using Mockito. You then get a walkthrough of the steps that will help you in applying Spring 4 Framework features and advanced Spring testing module features in the real world. By the end of the book, you will be a competent software tester with Spring and Mockito.
What You Will Learn
- Uncover the architecture of the Spring testing framework and write integration tests
- Explore test doubles and work with dummy, spy, fake, stub, and mock objects
- Mock Spring container dependencies using Mockito
- Refresh your Spring Framework knowledge
- Learn about the advanced Spring 4 Framework features
- Work with the REST controller to build and unit test RESTful web services
- Cache data with Spring and EhCache
Table of contents
-
Mockito for Spring
- Table of Contents
- Mockito for Spring
- Credits
- About the Author
- About the Reviewers
- www.PacktPub.com
- Preface
-
1. Getting Familiar with the Spring Framework
- Getting started with Spring
- Exploring the Spring architecture
- Learning the Inversion of Control
- Printing Hello World
- Examining life cycle messages
- Working with autowiring and annotations
- Working with aspects
- Exploring Spring JDBC
- Handling a transaction with Spring
- Building an MVC application with Spring
- Summary
-
2. Working with JUnit and Mockito
- Learning unit testing
- Working with the JUnit framework
- Working with Mockito
- Exploring Mockito
- Summary
- 3. Working with Spring Tests
- 4. Resolving Out-of-container Dependencies with Mockito
- 5. Time Travelling with Spring
- Index
Product information
- Title: Mockito for Spring
- Author(s):
- Release date: February 2015
- Publisher(s): Packt Publishing
- ISBN: 9781783983780
You might also like
book
Mockito Essentials
A practical guide to get you up and running with unit testing using Mockito In Detail …
book
Spring Boot 2.0 Projects
Develop diverse real-life projects including most aspects of Spring Boot Key Features Run production-grade based applications …
book
Developing Java Applications with Spring and Spring Boot
An end-to-end software development guide for the Java eco-system using the most advanced frameworks: Spring and …
book
Pragmatic Unit Testing in Java 8 with JUnit
The Pragmatic Programmers classic is back! Freshly updated for modern software development, Pragmatic Unit Testing in …