27
27
import org .springframework .ui .Model ;
28
28
import org .springframework .ui .ModelMap ;
29
29
import org .springframework .validation .BindingResult ;
30
- import org .springframework .web .HttpSessionRequiredException ;
31
30
import org .springframework .web .bind .WebDataBinder ;
32
31
import org .springframework .web .bind .annotation .ModelAttribute ;
33
32
import org .springframework .web .bind .annotation .SessionAttributes ;
43
42
import org .springframework .web .testfixture .servlet .MockHttpServletRequest ;
44
43
45
44
import static org .assertj .core .api .Assertions .assertThat ;
46
- import static org .assertj .core .api .Assertions .assertThatExceptionOfType ;
45
+ import static org .assertj .core .api .Assertions .assertThatIllegalStateException ;
47
46
import static org .mockito .BDDMockito .given ;
48
47
import static org .mockito .Mockito .mock ;
49
48
@@ -151,7 +150,7 @@ void sessionAttribute() throws Exception {
151
150
void sessionAttributeNotPresent () throws Exception {
152
151
ModelFactory modelFactory = new ModelFactory (null , null , this .attributeHandler );
153
152
HandlerMethod handlerMethod = createHandlerMethod ("handleSessionAttr" , String .class );
154
- assertThatExceptionOfType ( HttpSessionRequiredException . class ).isThrownBy (() ->
153
+ assertThatIllegalStateException ( ).isThrownBy (() ->
155
154
modelFactory .initModel (this .webRequest , this .mavContainer , handlerMethod ));
156
155
157
156
// Now add attribute and try again
@@ -164,7 +163,7 @@ void sessionAttributeNotPresent() throws Exception {
164
163
void sessionAttributeByType () throws Exception {
165
164
ModelFactory modelFactory = new ModelFactory (null , null , this .attributeHandler );
166
165
HandlerMethod handlerMethod = createHandlerMethod ("handleTestBean" , TestBean .class );
167
- assertThatExceptionOfType ( HttpSessionRequiredException . class ).isThrownBy (() ->
166
+ assertThatIllegalStateException ( ).isThrownBy (() ->
168
167
modelFactory .initModel (this .webRequest , this .mavContainer , handlerMethod ));
169
168
170
169
// Now add attribute and try again
0 commit comments