style: apply spotless (trim whitespace, unused imports)
This commit is contained in:
parent
b771cc1c98
commit
4d999c89a8
64 changed files with 317 additions and 317 deletions
|
|
@ -16,7 +16,7 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||
class JumpValidatorTest {
|
||||
|
||||
private JumpValidator validator;
|
||||
|
||||
|
||||
@Mock
|
||||
private World world;
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ class JumpValidatorTest {
|
|||
// 1 block forward, same height - always possible
|
||||
Location from = new Location(world, 0, 100, 0);
|
||||
Location to = new Location(world, 1, 100, 0);
|
||||
|
||||
|
||||
assertTrue(validator.canJump(from, to), "1 block jump at same level should be possible");
|
||||
}
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ class JumpValidatorTest {
|
|||
// 4 blocks forward, same height - possible
|
||||
Location from = new Location(world, 0, 100, 0);
|
||||
Location to = new Location(world, 4, 100, 0);
|
||||
|
||||
|
||||
assertTrue(validator.canJump(from, to), "4 block jump at same level should be possible");
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ class JumpValidatorTest {
|
|||
// 5 blocks forward, same height - impossible without speed
|
||||
Location from = new Location(world, 0, 100, 0);
|
||||
Location to = new Location(world, 5, 100, 0);
|
||||
|
||||
|
||||
assertFalse(validator.canJump(from, to), "5 block jump at same level should be impossible");
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ class JumpValidatorTest {
|
|||
// 3 blocks forward, 1 block up - possible
|
||||
Location from = new Location(world, 0, 100, 0);
|
||||
Location to = new Location(world, 3, 101, 0);
|
||||
|
||||
|
||||
assertTrue(validator.canJump(from, to), "3 block jump with 1 up should be possible");
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ class JumpValidatorTest {
|
|||
// 4 blocks forward, 1 block up - impossible
|
||||
Location from = new Location(world, 0, 100, 0);
|
||||
Location to = new Location(world, 4, 101, 0);
|
||||
|
||||
|
||||
assertFalse(validator.canJump(from, to), "4 block jump with 1 up should be impossible");
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ class JumpValidatorTest {
|
|||
// 4 blocks forward, 1 block down - possible
|
||||
Location from = new Location(world, 0, 100, 0);
|
||||
Location to = new Location(world, 4, 99, 0);
|
||||
|
||||
|
||||
assertTrue(validator.canJump(from, to), "4 block jump with 1 down should be possible");
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ class JumpValidatorTest {
|
|||
// 4 blocks forward, 2 blocks down - possible
|
||||
Location from = new Location(world, 0, 100, 0);
|
||||
Location to = new Location(world, 4, 98, 0);
|
||||
|
||||
|
||||
assertTrue(validator.canJump(from, to), "4 block jump with 2 down should be possible");
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ class JumpValidatorTest {
|
|||
// 1 block forward, 2 blocks up - impossible (max jump height is 1.25)
|
||||
Location from = new Location(world, 0, 100, 0);
|
||||
Location to = new Location(world, 1, 102, 0);
|
||||
|
||||
|
||||
assertFalse(validator.canJump(from, to), "Jump 2 blocks up should be impossible");
|
||||
}
|
||||
|
||||
|
|
@ -112,11 +112,11 @@ class JumpValidatorTest {
|
|||
void testCanJump_NullLocations() {
|
||||
// Test null safety
|
||||
Location validLoc = new Location(world, 0, 100, 0);
|
||||
assertFalse(validator.canJump((Location)null, validLoc),
|
||||
assertFalse(validator.canJump((Location)null, validLoc),
|
||||
"Should return false for null from location");
|
||||
assertFalse(validator.canJump(validLoc, (Location)null),
|
||||
assertFalse(validator.canJump(validLoc, (Location)null),
|
||||
"Should return false for null to location");
|
||||
assertFalse(validator.canJump((Location)null, (Location)null),
|
||||
assertFalse(validator.canJump((Location)null, (Location)null),
|
||||
"Should return false for both null locations");
|
||||
}
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ class JumpValidatorTest {
|
|||
void testCanJump_SameLocation() {
|
||||
// Jump to same location - should be false
|
||||
Location loc = new Location(world, 0, 100, 0);
|
||||
|
||||
|
||||
assertFalse(validator.canJump(loc, loc), "Jump to same location should be impossible");
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ class JumpValidatorTest {
|
|||
// 10 blocks forward - impossible
|
||||
Location from = new Location(world, 0, 100, 0);
|
||||
Location to = new Location(world, 10, 100, 0);
|
||||
|
||||
|
||||
assertFalse(validator.canJump(from, to), "10 block jump should be impossible");
|
||||
}
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ class JumpValidatorTest {
|
|||
// but it documents the expected behavior
|
||||
Location from = new Location(world, 0, 100, 0);
|
||||
Location to = new Location(world, 2, 101, 0);
|
||||
|
||||
|
||||
// This should still pass with mock objects (no slab detection)
|
||||
assertTrue(validator.canJump(from, to), "2 block jump with 1 up should be possible from mock location");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ class GhostDataTest {
|
|||
List<GhostFrame> frames = new ArrayList<>();
|
||||
frames.add(new GhostFrame(0, 0, 100, 0, 0, 0));
|
||||
frames.add(new GhostFrame(1000, 1, 100, 0, 90, 0));
|
||||
|
||||
|
||||
UUID uuid = UUID.randomUUID();
|
||||
GhostData data = new GhostData(uuid, "TestPlayer", 42, frames);
|
||||
|
||||
|
||||
assertEquals("TestPlayer", data.getPlayerName());
|
||||
assertEquals(uuid, data.getPlayerUuid());
|
||||
assertEquals(42, data.getScore());
|
||||
|
|
@ -47,21 +47,21 @@ class GhostDataTest {
|
|||
frames.add(new GhostFrame(0, 0, 100, 0, 0, 0));
|
||||
frames.add(new GhostFrame(500, 1, 100, 0, 45, 0));
|
||||
frames.add(new GhostFrame(1000, 2, 100, 0, 90, 0));
|
||||
|
||||
|
||||
UUID uuid = UUID.randomUUID();
|
||||
long timestamp = 1_700_000_000_000L;
|
||||
GhostData original = new GhostData(uuid, "Player1", 100, timestamp, "world", frames);
|
||||
|
||||
|
||||
// Save to file
|
||||
File file = tempDir.resolve("test.ghost").toFile();
|
||||
original.saveToFile(file);
|
||||
|
||||
|
||||
assertTrue(file.exists(), "Ghost file should be created");
|
||||
assertTrue(file.length() > 0, "Ghost file should not be empty");
|
||||
|
||||
|
||||
// Load from file
|
||||
GhostData loaded = GhostData.loadFromFile(file);
|
||||
|
||||
|
||||
// Verify data
|
||||
assertEquals(original.getPlayerName(), loaded.getPlayerName());
|
||||
assertEquals(original.getPlayerUuid(), loaded.getPlayerUuid());
|
||||
|
|
@ -70,12 +70,12 @@ class GhostDataTest {
|
|||
assertEquals(original.getWorldName(), loaded.getWorldName());
|
||||
assertEquals("world", loaded.getWorldName());
|
||||
assertEquals(original.getFrames().size(), loaded.getFrames().size());
|
||||
|
||||
|
||||
// Verify frames
|
||||
for (int i = 0; i < original.getFrames().size(); i++) {
|
||||
GhostFrame origFrame = original.getFrames().get(i);
|
||||
GhostFrame loadedFrame = loaded.getFrames().get(i);
|
||||
|
||||
|
||||
assertEquals(origFrame.getTimestamp(), loadedFrame.getTimestamp());
|
||||
assertEquals(origFrame.getX(), loadedFrame.getX(), 0.001);
|
||||
assertEquals(origFrame.getY(), loadedFrame.getY(), 0.001);
|
||||
|
|
@ -90,12 +90,12 @@ class GhostDataTest {
|
|||
// Test with no frames
|
||||
UUID uuid = UUID.randomUUID();
|
||||
GhostData data = new GhostData(uuid, "EmptyPlayer", 0, new ArrayList<>());
|
||||
|
||||
|
||||
File file = tempDir.resolve("empty.ghost").toFile();
|
||||
data.saveToFile(file);
|
||||
|
||||
|
||||
GhostData loaded = GhostData.loadFromFile(file);
|
||||
|
||||
|
||||
assertEquals(0, loaded.getFrames().size());
|
||||
assertEquals("EmptyPlayer", loaded.getPlayerName());
|
||||
}
|
||||
|
|
@ -114,15 +114,15 @@ class GhostDataTest {
|
|||
0 // Pitch
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
UUID uuid = UUID.randomUUID();
|
||||
GhostData data = new GhostData(uuid, "LongRunner", 1200, frames);
|
||||
|
||||
|
||||
File file = tempDir.resolve("large.ghost").toFile();
|
||||
data.saveToFile(file);
|
||||
|
||||
|
||||
GhostData loaded = GhostData.loadFromFile(file);
|
||||
|
||||
|
||||
assertEquals(1200, loaded.getFrames().size());
|
||||
assertEquals(1200, loaded.getScore());
|
||||
}
|
||||
|
|
@ -133,16 +133,16 @@ class GhostDataTest {
|
|||
UUID uuid = UUID.randomUUID();
|
||||
GhostData data = new GhostData(
|
||||
uuid,
|
||||
"Player_123-ABC",
|
||||
50,
|
||||
"Player_123-ABC",
|
||||
50,
|
||||
List.of(new GhostFrame(0, 0, 100, 0, 0, 0))
|
||||
);
|
||||
|
||||
|
||||
File file = tempDir.resolve("special.ghost").toFile();
|
||||
data.saveToFile(file);
|
||||
|
||||
|
||||
GhostData loaded = GhostData.loadFromFile(file);
|
||||
|
||||
|
||||
assertEquals("Player_123-ABC", loaded.getPlayerName());
|
||||
}
|
||||
|
||||
|
|
@ -152,15 +152,15 @@ class GhostDataTest {
|
|||
List<GhostFrame> frames = new ArrayList<>();
|
||||
frames.add(new GhostFrame(0, -100, 50, -200, -90, -45));
|
||||
frames.add(new GhostFrame(1000, -99, 51, -199, -45, 0));
|
||||
|
||||
|
||||
UUID uuid = UUID.randomUUID();
|
||||
GhostData data = new GhostData(uuid, "NegativePlayer", 10, frames);
|
||||
|
||||
|
||||
File file = tempDir.resolve("negative.ghost").toFile();
|
||||
data.saveToFile(file);
|
||||
|
||||
|
||||
GhostData loaded = GhostData.loadFromFile(file);
|
||||
|
||||
|
||||
GhostFrame frame = loaded.getFrames().get(0);
|
||||
assertEquals(-100, frame.getX(), 0.001);
|
||||
assertEquals(50, frame.getY(), 0.001);
|
||||
|
|
@ -173,7 +173,7 @@ class GhostDataTest {
|
|||
void testLoadNonExistentFile() {
|
||||
// Test loading from non-existent file
|
||||
File file = new File("nonexistent.ghost");
|
||||
|
||||
|
||||
assertThrows(IOException.class, () -> {
|
||||
GhostData.loadFromFile(file);
|
||||
}, "Should throw IOException for non-existent file");
|
||||
|
|
@ -184,15 +184,15 @@ class GhostDataTest {
|
|||
// Test that frames list is copied (defensive copy)
|
||||
List<GhostFrame> originalFrames = new ArrayList<>();
|
||||
originalFrames.add(new GhostFrame(0, 0, 100, 0, 0, 0));
|
||||
|
||||
|
||||
UUID uuid = UUID.randomUUID();
|
||||
GhostData data = new GhostData(uuid, "Player", 10, originalFrames);
|
||||
|
||||
|
||||
// Modify original list
|
||||
originalFrames.add(new GhostFrame(1000, 1, 100, 0, 0, 0));
|
||||
|
||||
|
||||
// GhostData should still have only 1 frame
|
||||
assertEquals(1, data.getFrames().size(),
|
||||
assertEquals(1, data.getFrames().size(),
|
||||
"GhostData should create defensive copy of frames list");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue