Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraLS3 committed Aug 20, 2018
1 parent 5e2c540 commit d587892
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
22 changes: 14 additions & 8 deletions Plan/src/main/java/com/djrapitops/plan/data/container/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,8 @@ public boolean equals(Object o) {
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
Expand Down Expand Up @@ -252,4 +246,16 @@ private String getLongestWorldPlayed() {

return theWorld + " (" + Formatters.percentage().apply(quotient) + ")";
}

@Override
public String toString() {
return "Session{" +
"sessionStart=" + sessionStart +
", worldTimes=" + worldTimes +
", playerKills=" + playerKills +
", mobKills=" + mobKills +
", deaths=" + deaths +
", afkTime=" + afkTime +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -36,6 +33,11 @@ public void setUp() {
sessionCache.cacheSession(uuid, session);
}

@After
public void tearDown() {
SessionCache.clear();
}

@Test
public void testAtomity() {
SessionCache reloaded = new SessionCache(null);
Expand Down

0 comments on commit d587892

Please sign in to comment.