### Question:
LocalOperations implements SessionOperations { public SessionInfo refresh(Session session, boolean reset) throws SessionException { SessionID sessionID = session.getID(); if (debug.messageEnabled()) { debug.message(MessageFormat.format( "Local fetch SessionInfo for {0}\n" + "Reset: {1}", sessionID.toString(), reset)); } return service.getSessionInfo(sessionID, reset); } @Inject  LocalOperations(@Named(SessionConstants.SESSION_DEBUG) Debug debug, SessionService service); SessionInfo refresh(Session session, boolean reset); void logout(Session session); @Override void destroy(Session requester, Session session); void setProperty(Session session, String name, String value);  }### Answer:
@Test public void shouldReturnSessionInfoOnRefresh() throws SessionException { SessionInfo mockSessionInfo = mock(SessionInfo.class); given(mockService.getSessionInfo(nullable(SessionID.class), anyBoolean())).willReturn(mockSessionInfo); SessionInfo result = local.refresh(mock(Session.class), true); assertThat(result).isEqualTo(mockSessionInfo); }
@Test public void shouldUseSessionServiceForRefresh() throws SessionException { boolean flag = true; local.refresh(mockSession, flag); verify(mockService).getSessionInfo(eq(mockSessionID), eq(flag)); }
@Test public void shouldReturnSessionInfoOnRefresh() throws SessionException { SessionInfo mockSessionInfo = mock(SessionInfo.class); given(mockService.getSessionInfo(any(SessionID.class), anyBoolean())).willReturn(mockSessionInfo); SessionInfo result = local.refresh(mock(Session.class), true); assertThat(result).isEqualTo(mockSessionInfo); }