Search in sources :

Example 6 with MyTestSessionManager

use of com.tvd12.ezyfoxserver.testing.MyTestSessionManager in project ezyfox-server by youngmonkeys.

the class EzySimpleSessionManagerTest method isUnloggedInSessionTrueTest.

@Test
public void isUnloggedInSessionTrueTest() {
    // given
    MyTestSessionManager manager = new MyTestSessionManager.Builder().build();
    EzySession session = mock(EzySession.class);
    when(session.isLoggedIn()).thenReturn(false);
    when(session.isActivated()).thenReturn(true);
    when(session.getMaxWaitingTime()).thenReturn(0L);
    when(session.getCreationTime()).thenReturn(System.currentTimeMillis() + 1);
    // when
    Boolean result = MethodInvoker.create().object(manager).method("isUnloggedInSession").param(EzySession.class, session).invoke(Boolean.class);
    // then
    Asserts.assertTrue(result);
}
Also used : MyTestSessionManager(com.tvd12.ezyfoxserver.testing.MyTestSessionManager) EzySession(com.tvd12.ezyfoxserver.entity.EzySession) BaseCoreTest(com.tvd12.ezyfoxserver.testing.BaseCoreTest) Test(org.testng.annotations.Test)

Aggregations

BaseCoreTest (com.tvd12.ezyfoxserver.testing.BaseCoreTest)6 MyTestSessionManager (com.tvd12.ezyfoxserver.testing.MyTestSessionManager)6 Test (org.testng.annotations.Test)6 EzySession (com.tvd12.ezyfoxserver.entity.EzySession)2 MyTestSession (com.tvd12.ezyfoxserver.testing.MyTestSession)2 EzyAbstractSessionDelegate (com.tvd12.ezyfoxserver.delegate.EzyAbstractSessionDelegate)1 EzyMaxSessionException (com.tvd12.ezyfoxserver.exception.EzyMaxSessionException)1 EzyChannel (com.tvd12.ezyfoxserver.socket.EzyChannel)1