1
1
/*
2
- * Copyright 2002-2015 the original author or authors.
2
+ * Copyright 2002-2016 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
23
23
import javax .servlet .http .HttpServletRequest ;
24
24
import javax .servlet .http .HttpServletResponse ;
25
25
26
+ import com .fasterxml .jackson .databind .JsonSerializer ;
27
+ import com .fasterxml .jackson .databind .ser .impl .UnknownSerializer ;
26
28
import org .junit .Test ;
27
29
28
30
import org .springframework .http .converter .json .SpringHandlerInstantiator ;
36
38
import org .springframework .web .servlet .HandlerExecutionChain ;
37
39
import org .springframework .web .servlet .mvc .method .annotation .RequestMappingHandlerMapping ;
38
40
39
- import com .fasterxml .jackson .databind .JsonSerializer ;
40
- import com .fasterxml .jackson .databind .ser .impl .UnknownSerializer ;
41
-
42
41
import static org .junit .Assert .*;
43
42
44
43
/**
50
49
*/
51
50
public class StandaloneMockMvcBuilderTests {
52
51
53
- // SPR-10825
54
-
55
- @ Test
52
+ @ Test // SPR-10825
56
53
public void placeHoldersInRequestMapping () throws Exception {
57
54
TestStandaloneMockMvcBuilder builder = new TestStandaloneMockMvcBuilder (new PlaceholderController ());
58
- builder .addPlaceHolderValue ("sys.login.ajax" , "/foo" );
55
+ builder .addPlaceholderValue ("sys.login.ajax" , "/foo" );
59
56
builder .build ();
60
57
61
58
RequestMappingHandlerMapping hm = builder .wac .getBean (RequestMappingHandlerMapping .class );
@@ -67,9 +64,7 @@ public void placeHoldersInRequestMapping() throws Exception {
67
64
assertEquals ("handleWithPlaceholders" , ((HandlerMethod ) chain .getHandler ()).getMethod ().getName ());
68
65
}
69
66
70
- // SPR-13637
71
-
72
- @ Test
67
+ @ Test // SPR-13637
73
68
public void suffixPatternMatch () throws Exception {
74
69
TestStandaloneMockMvcBuilder builder = new TestStandaloneMockMvcBuilder (new PersonController ());
75
70
builder .setUseSuffixPatternMatch (false );
@@ -87,18 +82,15 @@ public void suffixPatternMatch() throws Exception {
87
82
assertNull (chain );
88
83
}
89
84
90
- // SPR-12553
91
-
92
- @ Test
85
+ @ Test // SPR-12553
93
86
public void applicationContextAttribute () {
94
87
TestStandaloneMockMvcBuilder builder = new TestStandaloneMockMvcBuilder (new PlaceholderController ());
95
- builder .addPlaceHolderValue ("sys.login.ajax" , "/foo" );
88
+ builder .addPlaceholderValue ("sys.login.ajax" , "/foo" );
96
89
WebApplicationContext wac = builder .initWebAppContext ();
97
90
assertEquals (wac , WebApplicationContextUtils
98
91
.getRequiredWebApplicationContext (wac .getServletContext ()));
99
92
}
100
93
101
-
102
94
@ Test (expected = IllegalArgumentException .class )
103
95
public void addFiltersFiltersNull () {
104
96
StandaloneMockMvcBuilder builder = MockMvcBuilders .standaloneSetup (new PersonController ());
@@ -123,9 +115,7 @@ public void addFilterPatternContainsNull() {
123
115
builder .addFilter (new ContinueFilter (), (String ) null );
124
116
}
125
117
126
- // SPR-13375
127
-
128
- @ Test
118
+ @ Test // SPR-13375
129
119
@ SuppressWarnings ("rawtypes" )
130
120
public void springHandlerInstantiator () {
131
121
TestStandaloneMockMvcBuilder builder = new TestStandaloneMockMvcBuilder (new PersonController ());
@@ -159,6 +149,7 @@ protected WebApplicationContext initWebAppContext() {
159
149
}
160
150
}
161
151
152
+
162
153
@ Controller
163
154
private static class PersonController {
164
155
@@ -173,6 +164,7 @@ public String forward() {
173
164
}
174
165
}
175
166
167
+
176
168
private class ContinueFilter extends OncePerRequestFilter {
177
169
178
170
@ Override
0 commit comments