Fixed tests

This commit is contained in:
Rsl1122 2018-08-20 11:44:21 +03:00
parent 5e2c540522
commit d587892df2
2 changed files with 20 additions and 12 deletions

View File

@ -182,14 +182,8 @@ public class Session extends DataContainer implements DateHolder {
getValue(SessionKeys.END).orElse(-1L).equals(session.getValue(SessionKeys.END).orElse(-1L)) &&
mobKills == session.mobKills &&
deaths == session.deaths &&
Objects.equals(
getValue(SessionKeys.WORLD_TIMES).orElse(null),
session.getValue(SessionKeys.WORLD_TIMES).orElse(null)
) &&
Objects.equals(
getValue(SessionKeys.PLAYER_KILLS).orElse(new ArrayList<>()),
session.getValue(SessionKeys.PLAYER_KILLS).orElse(new ArrayList<>())
);
Objects.equals(playerKills, session.playerKills) &&
Objects.equals(worldTimes, session.worldTimes);
}
@Override
@ -252,4 +246,16 @@ public class Session extends DataContainer implements DateHolder {
return theWorld + " (" + Formatters.percentage().apply(quotient) + ")";
}
@Override
public String toString() {
return "Session{" +
"sessionStart=" + sessionStart +
", worldTimes=" + worldTimes +
", playerKills=" + playerKills +
", mobKills=" + mobKills +
", deaths=" + deaths +
", afkTime=" + afkTime +
'}';
}
}

View File

@ -1,10 +1,7 @@
package com.djrapitops.plan.system.cache;
import com.djrapitops.plan.data.container.Session;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.*;
import org.junit.rules.TemporaryFolder;
import utilities.TestConstants;
import utilities.mocks.SystemMockUtil;
@ -36,6 +33,11 @@ public class SessionCacheTest {
sessionCache.cacheSession(uuid, session);
}
@After
public void tearDown() {
SessionCache.clear();
}
@Test
public void testAtomity() {
SessionCache reloaded = new SessionCache(null);