Book Image

Mockito for Spring

By : Sujoy Acharya
Book Image

Mockito for Spring

By: Sujoy Acharya

Overview of this book

Table of Contents (12 chapters)
Mockito for Spring
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Exploring the TestContext framework


Spring's TestContext framework is a generic, annotation-driven framework for unit and integration testing. The framework's resources are located in the org.springframework.test.context package. This framework believes in the design paradigm "convention over configuration," which means that the framework provides reasonable defaults for every configuration; the user can still override the unconventional aspects through annotation-based configuration. The TestContext framework provides support for JUnit and TestNG, such as a custom JUnit runner that allows non-invasive POJO test classes.

The framework consists of two classes and three interfaces. The following are the classes:

  • TestContext: This class provides the context in which a test is executed. It also makes the context management and caching supports available for the test instance. To load the application context, the ContextLoader interface (or SmartContextLoader) is used.

  • TestContextManager: This...