fix: make tests run in order
This commit is contained in:
parent
86e65043e1
commit
87a256c9c5
1 changed files with 15 additions and 3 deletions
|
@ -5,6 +5,7 @@ import be.seeseemelk.mockbukkit.ServerMock;
|
||||||
import be.seeseemelk.mockbukkit.entity.PlayerMock;
|
import be.seeseemelk.mockbukkit.entity.PlayerMock;
|
||||||
import org.junit.jupiter.api.*;
|
import org.junit.jupiter.api.*;
|
||||||
import xyz.atnrch.nicko.NickoBukkit;
|
import xyz.atnrch.nicko.NickoBukkit;
|
||||||
|
import xyz.atnrch.nicko.appearance.ActionResult;
|
||||||
import xyz.atnrch.nicko.appearance.AppearanceManager;
|
import xyz.atnrch.nicko.appearance.AppearanceManager;
|
||||||
import xyz.atnrch.nicko.config.Configuration;
|
import xyz.atnrch.nicko.config.Configuration;
|
||||||
import xyz.atnrch.nicko.config.DataSourceConfiguration;
|
import xyz.atnrch.nicko.config.DataSourceConfiguration;
|
||||||
|
@ -13,9 +14,9 @@ import xyz.atnrch.nicko.storage.PlayerDataStore;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
|
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||||
public class RedisCacheTest {
|
public class RedisCacheTest {
|
||||||
private static ServerMock server;
|
private static ServerMock server;
|
||||||
private static NickoBukkit plugin;
|
private static NickoBukkit plugin;
|
||||||
|
@ -35,6 +36,7 @@ public class RedisCacheTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Cache Profile")
|
@DisplayName("Cache Profile")
|
||||||
|
@Order(1)
|
||||||
public void cacheProfile() {
|
public void cacheProfile() {
|
||||||
final Optional<NickoProfile> optionalProfile = plugin.getDataStore().getData(player.getUniqueId());
|
final Optional<NickoProfile> optionalProfile = plugin.getDataStore().getData(player.getUniqueId());
|
||||||
assertTrue(optionalProfile.isPresent());
|
assertTrue(optionalProfile.isPresent());
|
||||||
|
@ -43,7 +45,8 @@ public class RedisCacheTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Update Cache Profile")
|
@DisplayName("Update Cache Profile")
|
||||||
public void updatePlayerCache() {
|
@Order(2)
|
||||||
|
public void updateCache() {
|
||||||
final PlayerDataStore dataStore = plugin.getDataStore();
|
final PlayerDataStore dataStore = plugin.getDataStore();
|
||||||
final AppearanceManager appearanceManager = AppearanceManager.get(player);
|
final AppearanceManager appearanceManager = AppearanceManager.get(player);
|
||||||
appearanceManager.setName("Notch");
|
appearanceManager.setName("Notch");
|
||||||
|
@ -54,6 +57,15 @@ public class RedisCacheTest {
|
||||||
assertEquals(retrieved.getName(), "Notch");
|
assertEquals(retrieved.getName(), "Notch");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Delete Cache Profile")
|
||||||
|
@Order(3)
|
||||||
|
public void deleteCache() {
|
||||||
|
final PlayerDataStore dataStore = plugin.getDataStore();
|
||||||
|
final ActionResult cacheDelete = dataStore.getCache().delete(player.getUniqueId());
|
||||||
|
assertFalse(cacheDelete.isError());
|
||||||
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void shutdown() {
|
public static void shutdown() {
|
||||||
MockBukkit.unmock();
|
MockBukkit.unmock();
|
||||||
|
|
Loading…
Reference in a new issue