mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-31 21:48:32 +01:00
Fix afk tracker tests
This commit is contained in:
parent
96e0cd6856
commit
954ef59c0b
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package com.djrapitops.plan.gathering.listeners;
|
||||
|
||||
import com.djrapitops.plan.gathering.cache.SessionCache;
|
||||
import com.djrapitops.plan.gathering.domain.ActiveSession;
|
||||
import com.djrapitops.plan.gathering.listeners.bukkit.BukkitAFKListener;
|
||||
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.settings.config.paths.TimeSettings;
|
||||
@ -51,6 +53,9 @@ class BukkitAFKListenerTest {
|
||||
when(config.get(TimeSettings.AFK_THRESHOLD)).thenReturn(TimeUnit.MINUTES.toMillis(3));
|
||||
errorLogger = Mockito.mock(ErrorLogger.class);
|
||||
underTest = new BukkitAFKListener(config, errorLogger);
|
||||
|
||||
new SessionCache().cacheSession(TestConstants.PLAYER_ONE_UUID, new ActiveSession(null, null, 0, null, null));
|
||||
new SessionCache().cacheSession(TestConstants.PLAYER_TWO_UUID, new ActiveSession(null, null, 0, null, null));
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
|
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package com.djrapitops.plan.gathering.afk;
|
||||
|
||||
import com.djrapitops.plan.gathering.cache.SessionCache;
|
||||
import com.djrapitops.plan.gathering.domain.ActiveSession;
|
||||
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.settings.config.paths.TimeSettings;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@ -41,6 +43,8 @@ class AFKTrackerTest {
|
||||
afkThreshold = TimeUnit.MINUTES.toMillis(1L);
|
||||
when(config.get(TimeSettings.AFK_THRESHOLD)).thenReturn(afkThreshold);
|
||||
|
||||
new SessionCache().cacheSession(playerUUID, new ActiveSession(playerUUID, null, 0, null, null));
|
||||
|
||||
underTest = new AFKTracker(config);
|
||||
}
|
||||
|
||||
@ -72,7 +76,7 @@ class AFKTrackerTest {
|
||||
|
||||
@Test
|
||||
void someOneIsNotEvenOnline() {
|
||||
assertFalse(underTest.isAfk(playerUUID));
|
||||
assertFalse(underTest.isAfk(TestConstants.PLAYER_TWO_UUID));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -18,6 +18,8 @@ package com.djrapitops.plan.gathering.listeners;
|
||||
|
||||
import cn.nukkit.Player;
|
||||
import cn.nukkit.event.player.PlayerMoveEvent;
|
||||
import com.djrapitops.plan.gathering.cache.SessionCache;
|
||||
import com.djrapitops.plan.gathering.domain.ActiveSession;
|
||||
import com.djrapitops.plan.gathering.listeners.nukkit.NukkitAFKListener;
|
||||
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.settings.config.paths.TimeSettings;
|
||||
@ -51,6 +53,9 @@ class NukkitAFKListenerTest {
|
||||
when(config.get(TimeSettings.AFK_THRESHOLD)).thenReturn(TimeUnit.MINUTES.toMillis(3));
|
||||
errorLogger = Mockito.mock(ErrorLogger.class);
|
||||
underTest = new NukkitAFKListener(config, errorLogger);
|
||||
|
||||
new SessionCache().cacheSession(TestConstants.PLAYER_ONE_UUID, new ActiveSession(null, null, 0, null, null));
|
||||
new SessionCache().cacheSession(TestConstants.PLAYER_TWO_UUID, new ActiveSession(null, null, 0, null, null));
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
|
Loading…
Reference in New Issue
Block a user