mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-02-09 08:51:44 +01:00
[Test] Fixed SessionCacheTest
This commit is contained in:
parent
50cc9a4304
commit
baad1b4c44
@ -1,11 +1,10 @@
|
||||
package com.djrapitops.plan.system.cache;
|
||||
|
||||
import com.djrapitops.plan.data.container.Session;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import org.junit.*;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import utilities.TestConstants;
|
||||
import utilities.mocks.SystemMockUtil;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
@ -15,25 +14,15 @@ import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class SessionCacheTest {
|
||||
|
||||
@ClassRule
|
||||
public static TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||
private SessionCache sessionCache;
|
||||
private Session session;
|
||||
private final UUID uuid = TestConstants.PLAYER_ONE_UUID;
|
||||
private final UUID serverUUID = TestConstants.SERVER_UUID;
|
||||
|
||||
private Database database; // TODO
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws Exception {
|
||||
SystemMockUtil.setUp(temporaryFolder.getRoot())
|
||||
.enableProcessing();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
sessionCache = new SessionCache(database);
|
||||
session = new Session(uuid, serverUUID, 12345L, "World1", "SURVIVAL");
|
||||
|
||||
SessionCache sessionCache = new SessionCache(null);
|
||||
sessionCache.cacheSession(uuid, session);
|
||||
}
|
||||
|
||||
@ -44,7 +33,6 @@ public class SessionCacheTest {
|
||||
|
||||
@Test
|
||||
public void testAtomity() {
|
||||
SessionCache reloaded = new SessionCache(database);
|
||||
Optional<Session> cachedSession = SessionCache.getCachedSession(uuid);
|
||||
assertTrue(cachedSession.isPresent());
|
||||
assertEquals(session, cachedSession.get());
|
||||
@ -54,7 +42,7 @@ public class SessionCacheTest {
|
||||
public void testBungeeReCaching() {
|
||||
SessionCache cache = new ProxyDataCache(null, null);
|
||||
cache.cacheSession(uuid, session);
|
||||
Session expected = new Session(uuid, TestConstants.SERVER_UUID, 0, "", "");
|
||||
Session expected = new Session(uuid, serverUUID, 0, "", "");
|
||||
cache.cacheSession(uuid, expected);
|
||||
|
||||
Optional<Session> result = SessionCache.getCachedSession(uuid);
|
||||
|
Loading…
Reference in New Issue
Block a user