@@ -3908,12 +3908,12 @@ to a degree:
3908
3908
3909
3909
Which setup option should you use?
3910
3910
3911
- The __"webAppContextSetup"__ loads the actual Spring MVC configuration resulting in a
3911
+ The __"webAppContextSetup"__ loads your actual Spring MVC configuration resulting in a
3912
3912
more complete integration test. Since the __TestContext framework__ caches the loaded
3913
- Spring configuration, it helps to keep tests running fast even as more tests get added.
3914
- Furthermore, you can inject mock services into controllers through Spring configuration,
3915
- in order to remain focused on testing the web layer. Here is an example of declaring a
3916
- mock service with Mockito:
3913
+ Spring configuration, it helps keep tests running fast, even as you introduce more tests
3914
+ in your test suite. Furthermore, you can inject mock services into controllers through
3915
+ Spring configuration in order to remain focused on testing the web layer. Here is an
3916
+ example of declaring a mock service with Mockito:
3917
3917
3918
3918
[source,xml,indent=0]
3919
3919
[subs="verbatim,quotes"]
@@ -3923,7 +3923,7 @@ mock service with Mockito:
3923
3923
</bean>
3924
3924
----
3925
3925
3926
- Then you can inject the mock service into the test in order set up and verify
3926
+ You can then inject the mock service into the test in order set up and verify
3927
3927
expectations:
3928
3928
3929
3929
[source,java,indent=0]
@@ -3948,17 +3948,17 @@ expectations:
3948
3948
----
3949
3949
3950
3950
The __"standaloneSetup"__ on the other hand is a little closer to a unit test. It tests
3951
- one controller at a time, the controller can be injected with mock dependencies
3952
- manually, and it doesn't involve loading Spring configuration. Such tests are more
3953
- focused in style and make it easier to see which controller is being tested, whether any
3954
- specific Spring MVC configuration is required to work, and so on. The "standaloneSetup"
3955
- is also a very convenient way to write ad-hoc tests to verify some behavior or to debug
3956
- an issue.
3957
-
3958
- Just like with integration vs unit testing, there is no right or wrong answer. Using the
3959
- "standaloneSetup" does imply the need for some additional "webAppContextSetup" tests to
3960
- verify the Spring MVC configuration. Alternatively, you can decide to write all tests with
3961
- "webAppContextSetup" and always test against actual Spring MVC configuration.
3951
+ one controller at a time: the controller can be injected with mock dependencies manually,
3952
+ and it doesn't involve loading Spring configuration. Such tests are more focused on style
3953
+ and make it easier to see which controller is being tested, whether any specific Spring
3954
+ MVC configuration is required to work, and so on. The "standaloneSetup" is also a very
3955
+ convenient way to write ad-hoc tests to verify specific behavior or to debug an issue.
3956
+
3957
+ Just like with any "integration vs. unit testing" debate, there is no right or wrong
3958
+ answer. However, using the "standaloneSetup" does imply the need for additional
3959
+ "webAppContextSetup" tests in order to verify your Spring MVC configuration.
3960
+ Alternatively, you may choose to write all tests with "webAppContextSetup" in order to
3961
+ always test against your actual Spring MVC configuration.
3962
3962
3963
3963
[[spring-mvc-test-server-performing-requests]]
3964
3964
===== Performing Requests
@@ -4033,7 +4033,7 @@ properties:
4033
4033
4034
4034
The above properties will affect every request performed through the `MockMvc` instance.
4035
4035
If the same property is also specified on a given request, it overrides the default value.
4036
- That is why the HTTP method and URI in default request don't matter since they must be
4036
+ That is why the HTTP method and URI in the default request don't matter since they must be
4037
4037
specified on every request.
4038
4038
4039
4039
[[spring-mvc-test-server-defining-expectations]]
0 commit comments