-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Labels
in: testIssues in the test moduleIssues in the test moduletype: regressionA bug that is also a regressionA bug that is also a regression
Milestone
Description
Rob Winch opened SPR-13260 and commented
The following has worked in prior versions of Spring Framework and the 4.2.0.BUILD-SNAPSHOT up until today. To be clear I believe this bug is a regression that is in 4.2.0.BUILD-SNAPSHOT.
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@WebAppConfiguration
public class MockMvcPerformTwiceTests {
@Autowired
WebApplicationContext context;
@Test
public void mockMvcPerformTwice() throws Exception {
final String SESSION_ATTR = "mockMvcPerformTwice";
MockMvc mvc = MockMvcBuilders
.webAppContextSetup(context)
.build();
mvc
.perform(get("/").sessionAttr(SESSION_ATTR, "value"))
.andExpect(request().sessionAttribute(SESSION_ATTR, not(nullValue())));
mvc
.perform(get("/"))
.andExpect(request().sessionAttribute(SESSION_ATTR, nullValue()));
}
@Configuration
@EnableWebMvc
static class Config {
@Bean
public MyController myController() {
return new MyController();
}
}
@RestController
static class MyController {
@RequestMapping("/")
public String hello() {
return "hello";
}
}
}
I believe this is related to the changes in #17803 but do not have time investigate further. I wanted to log this issue to ensure we figure out what is going on before GA.
Affects: 4.2 GA
Issue Links:
- Reuse MockHttpServletRequest from ServletTestExecutionListener in Spring MVC Test framework [SPR-13211] #17803 Reuse MockHttpServletRequest from ServletTestExecutionListener in Spring MVC Test framework
Referenced from: commits 3c799e6
Metadata
Metadata
Assignees
Labels
in: testIssues in the test moduleIssues in the test moduletype: regressionA bug that is also a regressionA bug that is also a regression