Working with annotations
The Spring Framework provides a set of Spring-specific annotations for unit and integration tests in conjunction with the TestContext
framework. The following are widely used annotations:
@ContextConfiguration
: We have already covered this annotation and loadedapplicationContext
for integration tests. This annotation is used to determine how to load and configure anApplicationContext
for integration tests.@ContextConfiguration
declares the application context's resource locations or the annotated classes that will be used to load the context.@WebAppConfiguration
: This class-level annotation is used to instruct the Spring context that theApplicationContext
loaded using the@ContextConfiguration
annotation is aWebApplicationContext ...
Get Mockito for Spring now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.