package com.example.tests;
import com.frotty27.hrtk.api.annotation.HytaleSuite;
import com.frotty27.hrtk.api.annotation.HytaleTest;
import com.frotty27.hrtk.api.annotation.WorldTest;
import com.frotty27.hrtk.api.annotation.Tag;
import com.frotty27.hrtk.api.annotation.DisplayName;
import com.frotty27.hrtk.api.annotation.Order;
import com.frotty27.hrtk.api.assert_.HytaleAssert;
import com.frotty27.hrtk.api.assert_.PersistenceAssert;
import com.frotty27.hrtk.api.context.WorldTestContext;
import com.frotty27.hrtk.api.lifecycle.IsolationStrategy;
import java.nio.file.Path;
@HytaleSuite(value = "Persistence Surface Tests", isolation = IsolationStrategy.DEDICATED_WORLD)
@Tag("persistence")
public class PersistenceSurfaceTests {
@WorldTest
@Order(1)
@DisplayName("World has a configured save path")
void worldSavePathExists(WorldTestContext ctx) {
// assertWorldSavePathExists checks that the world has a non-null save path.
// This verifies the server's persistence layer is configured for this world.
PersistenceAssert.assertWorldSavePathExists(ctx.getWorld());
}
@HytaleTest
@Order(2)
@DisplayName("Player storage system is available")
void playerStorageAvailable() {
// assertPlayerStorageAvailable locates the Universe singleton and
// verifies its player storage accessor returns a non-null value.
PersistenceAssert.assertPlayerStorageAvailable();
}
@WorldTest
@Order(3)
@DisplayName("World save path is a valid filesystem path")
void worldSavePathIsValid(WorldTestContext ctx) {
Path savePath = PersistenceTestAdapter.getWorldSavePath(ctx.getWorld());
HytaleAssert.assertNotNull(
"World save path should not be null",
savePath
);
}
@HytaleTest
@Order(4)
@DisplayName("Player storage class is on the classpath")
void playerStorageClassAvailable() {
HytaleAssert.assertTrue(
"PlayerStorage class should be available",
PersistenceTestAdapter.playerStorageAvailable()
);
}
}