assertNull(contextsService.getCurrentContext(SessionScoped.class));
}
@Test
public void ensureRequestContextCanBeRestarted() throws Exception {
final ApplicationComposers composers = new ApplicationComposers(EnsureRequestScopeThreadLocalIsCleanUpTest.class);
composers.before(this);
final CdiAppContextsService contextsService = CdiAppContextsService.class.cast(WebBeansContext.currentInstance().getService(ContextsService.class));
final Context req1 = contextsService.getCurrentContext(RequestScoped.class);
assertNotNull(req1);
final Context session1 = contextsService.getCurrentContext(SessionScoped.class);
assertNotNull(session1);
contextsService.endContext(RequestScoped.class, null);
contextsService.startContext(RequestScoped.class, null);
final Context req2 = contextsService.getCurrentContext(RequestScoped.class);
assertNotSame(req1, req2);
final Context session2 = contextsService.getCurrentContext(SessionScoped.class);
assertSame(session1, session2);
composers.after();
assertNull(contextsService.getCurrentContext(RequestScoped.class));
assertNull(contextsService.getCurrentContext(SessionScoped.class));
}