2727import org .springframework .ui .Model ;
2828import org .springframework .ui .ModelMap ;
2929import org .springframework .validation .BindingResult ;
30- import org .springframework .web .HttpSessionRequiredException ;
3130import org .springframework .web .bind .WebDataBinder ;
3231import org .springframework .web .bind .annotation .ModelAttribute ;
3332import org .springframework .web .bind .annotation .SessionAttributes ;
4342import org .springframework .web .testfixture .servlet .MockHttpServletRequest ;
4443
4544import 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 ;
4746import static org .mockito .BDDMockito .given ;
4847import static org .mockito .Mockito .mock ;
4948
@@ -151,7 +150,7 @@ void sessionAttribute() throws Exception {
151150 void sessionAttributeNotPresent () throws Exception {
152151 ModelFactory modelFactory = new ModelFactory (null , null , this .attributeHandler );
153152 HandlerMethod handlerMethod = createHandlerMethod ("handleSessionAttr" , String .class );
154- assertThatExceptionOfType ( HttpSessionRequiredException . class ).isThrownBy (() ->
153+ assertThatIllegalStateException ( ).isThrownBy (() ->
155154 modelFactory .initModel (this .webRequest , this .mavContainer , handlerMethod ));
156155
157156 // Now add attribute and try again
@@ -164,7 +163,7 @@ void sessionAttributeNotPresent() throws Exception {
164163 void sessionAttributeByType () throws Exception {
165164 ModelFactory modelFactory = new ModelFactory (null , null , this .attributeHandler );
166165 HandlerMethod handlerMethod = createHandlerMethod ("handleTestBean" , TestBean .class );
167- assertThatExceptionOfType ( HttpSessionRequiredException . class ).isThrownBy (() ->
166+ assertThatIllegalStateException ( ).isThrownBy (() ->
168167 modelFactory .initModel (this .webRequest , this .mavContainer , handlerMethod ));
169168
170169 // Now add attribute and try again
0 commit comments