SessionConfig config = mock(SessionConfig.class);
SessionManager<LocalSessionContext, Batch> manager = mock(SessionManager.class);
Batcher<Batch> batcher = mock(Batcher.class);
BatchContext context = mock(BatchContext.class);
Session<LocalSessionContext> session = mock(Session.class);
SessionAttributes oldAttributes = mock(SessionAttributes.class);
SessionAttributes newAttributes = mock(SessionAttributes.class);
SessionMetaData oldMetaData = mock(SessionMetaData.class);
SessionMetaData newMetaData = mock(SessionMetaData.class);
LocalSessionContext oldContext = mock(LocalSessionContext.class);
LocalSessionContext newContext = mock(LocalSessionContext.class);
String sessionId = "session";
String name = "name";
Object value = new Object();
Date date = new Date();
long interval = 10L;
AuthenticatedSession authenticatedSession = new AuthenticatedSession(null, null);
ArgumentCaptor<TimeUnit> capturedUnit = ArgumentCaptor.forClass(TimeUnit.class);
when(this.manager.getSessionManager()).thenReturn(manager);
when(manager.getBatcher()).thenReturn(batcher);
when(batcher.resumeBatch(this.batch)).thenReturn(context);
when(manager.createIdentifier()).thenReturn(sessionId);
when(manager.createSession(sessionId)).thenReturn(session);
when(this.session.getAttributes()).thenReturn(oldAttributes);
when(this.session.getMetaData()).thenReturn(oldMetaData);
when(session.getAttributes()).thenReturn(newAttributes);
when(session.getMetaData()).thenReturn(newMetaData);
when(oldAttributes.getAttributeNames()).thenReturn(Collections.singleton(name));
when(oldAttributes.getAttribute(name)).thenReturn(value);
when(newAttributes.setAttribute(name, value)).thenReturn(null);
when(oldMetaData.getLastAccessedTime()).thenReturn(date);
when(oldMetaData.getMaxInactiveInterval(capturedUnit.capture())).thenReturn(interval);
when(session.getId()).thenReturn(sessionId);
when(this.session.getLocalContext()).thenReturn(oldContext);
when(session.getLocalContext()).thenReturn(newContext);