@Test(groups = {INTEGRATION, ASYNC_SERVLET})
@SpecAssertions({ @SpecAssertion(section = REQUEST_CONTEXT, id = "ad"), @SpecAssertion(section = REQUEST_CONTEXT, id = "bd") })
public void testRequestContextActiveOnComplete() throws Exception {
WebClient webClient = new WebClient();
webClient.setThrowExceptionOnFailingStatusCode(true);
TextPage page01 = webClient.getPage(getPath(AsyncServlet.TEST_COMPLETE));
assertTrue(page01.getContent().contains("onTimeout: null"));
assertTrue(page01.getContent().contains("onError: null"));
assertFalse(page01.getContent().contains("onComplete: null"));
// Indirectly test request context is destroyed after onComplete()
TextPage page02 = webClient.getPage(getPath(AsyncServlet.TEST_COMPLETE));
assertNotEquals(extractSimpleRequestBeanIdString(page01.getContent()),
extractSimpleRequestBeanIdString(page02.getContent()));
}