### Question:
ServerSessionOperationStrategy implements SessionOperationStrategy { @Override public SessionOperations getOperation(Session session) { if (isClientSide(session)) { return logAndWrap(session, clientSide, SessionMonitorType.STATELESS); } if (isLocalServer(session)) { return logAndWrap(session, local, SessionMonitorType.LOCAL); } if (service.isSessionFailoverEnabled()) { if (service.isReducedCrossTalkEnabled()) { return logAndWrap(session, cts, SessionMonitorType.CTS); } if (!isLocalSite(session) && !isSiteUp(getSiteId(session))) { return logAndWrap(session, cts, SessionMonitorType.CTS); } } return logAndWrap(session, remote, SessionMonitorType.REMOTE); } @Inject  ServerSessionOperationStrategy(SessionService service,
            SessionMonitoringStore store,
            LocalOperations local,
            CTSOperations cts,
            RemoteOperations remote,
            StatelessOperations clientSide,
            WebtopNamingQuery queryUtils,
            StatelessSessionFactory statelessSessionFactory,
            @Named(SessionConstants.SESSION_DEBUG) Debug debug); @Override SessionOperations getOperation(Session session);  }### Answer:
@Test public void shouldUseLocalForLocalSessions() throws SessionException { given(mockSessionService.checkSessionLocal(any(SessionID.class))).willReturn(true); SessionOperations operation = strategy.getOperation(mockSession); assertThat(operation).isEqualTo(new MonitoredOperations(mockLocal, SessionMonitorType.LOCAL, mockStore)); }
@Test public void shouldUseRemoteForRemoteSessionsWhenCrossTalkIsEnabled() throws Exception { given(mockSessionService.checkSessionLocal(any(SessionID.class))).willReturn(false); given(mockSessionService.isReducedCrossTalkEnabled()).willReturn(false); SessionOperations operation = strategy.getOperation(mockSession); assertThat(operation).isEqualTo(new MonitoredOperations(mockRemote, SessionMonitorType.REMOTE, mockStore)); }
@Test public void shouldUseRemoteWhenFailoverIsDisabled() throws SessionException { given(mockSessionService.checkSessionLocal(any(SessionID.class))).willReturn(false); given(mockSessionService.isSessionFailoverEnabled()).willReturn(false); SessionOperations operation = strategy.getOperation(mockSession); assertThat(operation).isEqualTo(new MonitoredOperations(mockRemote, SessionMonitorType.REMOTE, mockStore)); }
@Test public void shouldUseCTSWhenCrossTalkDisabledCTSContainsSession() throws SessionException { given(mockSessionService.checkSessionLocal(any(SessionID.class))).willReturn(false); given(mockSessionService.isSessionFailoverEnabled()).willReturn(true); given(mockSessionService.isReducedCrossTalkEnabled()).willReturn(true); SessionOperations operation = strategy.getOperation(mockSession); assertThat(operation).isEqualTo(new MonitoredOperations(mockCTS, SessionMonitorType.CTS, mockStore)); }