diff --git a/spring-test/src/main/java/org/springframework/test/web/servlet/setup/AbstractMockMvcBuilder.java b/spring-test/src/main/java/org/springframework/test/web/servlet/setup/AbstractMockMvcBuilder.java index 125ccbe436..a20674b007 100644 --- a/spring-test/src/main/java/org/springframework/test/web/servlet/setup/AbstractMockMvcBuilder.java +++ b/spring-test/src/main/java/org/springframework/test/web/servlet/setup/AbstractMockMvcBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,14 +33,16 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.request.RequestPostProcessor; import org.springframework.util.Assert; import org.springframework.web.context.WebApplicationContext; +import org.springframework.test.web.servlet.MockMvcBuilder; /** - * An abstract implementation of {@link org.springframework.test.web.servlet.MockMvcBuilder} - * with common methods for configuring filters, default request properties, global - * expectations and global result actions. - *
- * Sub-classes can use different strategies to prepare a WebApplicationContext to - * pass to the DispatcherServlet. + * Abstract implementation of {@link MockMvcBuilder} with common methods for + * configuring filters, default request properties, global expectations and + * global result actions. + * + *
Sub-classes can use different strategies to prepare the Spring
+ * {@code WebApplicationContext} that will be passed to the
+ * {@code DispatcherServlet}.
*
* @author Rossen Stoyanchev
* @author Stephane Nicoll
@@ -64,7 +66,6 @@ public abstract class AbstractMockMvcBuilder
public final Can be plugged in via {@link ConfigurableMockMvcBuilder#apply} with
- * instances of this type likely created via static methods, e.g.:
+ * An implementation of this interface can be plugged in via
+ * {@link ConfigurableMockMvcBuilder#apply} with instances of this type likely
+ * created via static methods, e.g.:
*
*
- * MockMvcBuilders.webAppContextSetup(context).apply(mySetup("foo","bar")).build();
+ * import static org.example.ExampleSetup.mySetup;
+ *
+ * // ...
+ *
+ * MockMvcBuilders.webAppContextSetup(context).apply(mySetup("foo","bar")).build();
*
*
* @author Rossen Stoyanchev
@@ -39,16 +43,22 @@ import org.springframework.web.context.WebApplicationContext;
public interface MockMvcConfigurer {
/**
- * Invoked immediately after a {@code MockMvcConfigurer} is added via
+ * Invoked immediately when this {@code MockMvcConfigurer} is added via
* {@link ConfigurableMockMvcBuilder#apply}.
+ * @param builder the builder for the MockMvc
*/
void afterConfigurerAdded(ConfigurableMockMvcBuilder> builder);
/**
- * Invoked just before the MockMvc instance is created. Implementations may
- * return a RequestPostProcessor to be applied to every request performed
- * through the created {@code MockMvc} instance.
+ * Invoked when the MockMvc instance is about to be created with the MockMvc
+ * builder and the Spring WebApplicationContext that will be passed to the
+ * {@code DispatcherServlet}.
+ * @param builder the builder for the MockMvc
+ * @param context the Spring configuration
+ * @return a post processor to be applied to every request performed
+ * through the {@code MockMvc} instance.
*/
- RequestPostProcessor beforeMockMvcCreated(ConfigurableMockMvcBuilder> builder, WebApplicationContext context);
+ RequestPostProcessor beforeMockMvcCreated(ConfigurableMockMvcBuilder> builder,
+ WebApplicationContext context);
}