mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-28 20:17:42 +01:00
Add missing files to VCS
This commit is contained in:
parent
dc15c61953
commit
7118c67c7e
44
Plan/test/main/java/com/djrapitops/plan/system/cache/SessionCacheTest.java
vendored
Normal file
44
Plan/test/main/java/com/djrapitops/plan/system/cache/SessionCacheTest.java
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
package com.djrapitops.plan.system.cache;
|
||||
|
||||
import com.djrapitops.plan.data.container.Session;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.utilities.MockUtils;
|
||||
import test.utilities.TestInit;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest(JavaPlugin.class)
|
||||
public class SessionCacheTest {
|
||||
|
||||
private final UUID uuid = MockUtils.getPlayerUUID();
|
||||
private SessionCache sessionCache;
|
||||
private Session session;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
TestInit t = TestInit.init();
|
||||
sessionCache = new SessionCache(null);
|
||||
session = new Session(12345L, "World1", "SURVIVAL");
|
||||
sessionCache.cacheSession(uuid, session);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Ignored, Requires more mocks")
|
||||
public void testAtomity() {
|
||||
SessionCache reloaded = new SessionCache(null);
|
||||
Optional<Session> cachedSession = reloaded.getCachedSession(uuid);
|
||||
assertTrue(cachedSession.isPresent());
|
||||
assertEquals(session, cachedSession.get());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user