Книги и журналы » Компьютерная литература » Программирование (книги)
Mockito for SpringГод: 2015
Автор: Sujoy Acharya
Издательство: Packt Publishing
ISBN: 978-1-78398-378-0
Язык: Английский
Формат: PDF/EPUB
Качество: Изначально компьютерное (eBook)
Интерактивное оглавление: Да
Количество страниц: 178
Описание:
About This BookLearn about the Spring testing framework, stubbing, mocking, and spying dependencies using the Mockito framework and explore its advanced features
Create an automated JUnit safety net for building a reliable, maintainable, and testable software
Step-by-step tutorial stuffed with real-world examples
Who This Book Is ForIf you are an application developer with some experience in software testing and want to learn more about testing frameworks, then this technology and book is for you. Mockito for Spring will be perfect as your next step towards becoming a competent software tester with Spring and Mockito.
What You Will LearnUncover 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
In DetailMockito 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.
[spoiler="Примеры страниц"]

[/spoiler]
[spoiler="Оглавление"]
Preface
Chapter 1: Getting Familiar with the Spring FrameworkGetting started with Spring
Exploring the Spring architecture
The core container
The AOP module
The instrumentation module
The messaging module
The data access module
The web layer
The test module
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
Working with declarative Spring transaction
Exploring transaction attributes
Using the @Transactional annotation
Working with a programmatic Spring transaction
Using TransactionTemplate
Using PlatformTransactionManager
Building an MVC application with Spring
Chapter 2: Working with JUnit and MockitoLearning unit testing
Working with the JUnit framework
Configuring Eclipse
Examining annotations
Verifying an expectation with an assertion
Examining exception handling
Working with the @RunWith annotation
Working with test suites
Working with assertThat
Exploring equalTo, is, and not
Exploring compound matchers – either, both, anyOf, and allOf
Exploring collection matchers – hasItem and hasItems
Working with string matchers – startsWith, endsWith, and containsString
Exploring custom matchers
Working with Mockito
Learning the significance of Mockito
Exploring Mockito
Configuring Mockito
Mocking in action
Mocking objects
Stubbing methods
Throwing exceptions
Chapter 3: Working with Spring TestsExploring the TestContext framework
Writing a custom TestExecutionListener interface
Configuring Spring profiles
Mocking an environment
Mocking the JNDI lookup
Using ReflectionTestUtils
Working with annotations
Testing Spring MVC
Mocking the servlet container with MockMvc
Handling transactions in Spring tests
Chapter 4: Resolving Out-of-container Dependencies with MockitoUnit testing the web layer
Unit testing the service layer
Unit testing the data access layer
Chapter 5: Time Travelling with SpringDiscovering the new Spring release
Working with asynchronous tasks
Exploring @RestController
Learning AsyncRestTemplate
Caching objects
Index[/spoiler]