mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Add unit test for BlockLocationHistory
Move ChunkStoreTest to correct package
This commit is contained in:
parent
9e2d5aada8
commit
a57e6d3bbe
@ -0,0 +1,37 @@
|
|||||||
|
package com.gmail.nossr50.datatypes;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class BlockLocationHistoryTest {
|
||||||
|
@Test
|
||||||
|
public void testRemovesOldestElement() {
|
||||||
|
BlockLocationHistory history = new BlockLocationHistory(2);
|
||||||
|
Location locationA = new Location(null, 0, 1, 2);
|
||||||
|
Location locationB = new Location(null, 1, 2, 3);
|
||||||
|
Location locationC = new Location(null, 2, 3, 4);
|
||||||
|
|
||||||
|
history.add(locationA);
|
||||||
|
history.add(locationB);
|
||||||
|
history.add(locationC);
|
||||||
|
Assert.assertFalse(history.contains(locationA));
|
||||||
|
Assert.assertTrue(history.contains(locationB));
|
||||||
|
Assert.assertTrue(history.contains(locationC));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSupportsDuplicateElement() {
|
||||||
|
BlockLocationHistory history = new BlockLocationHistory(2);
|
||||||
|
Location locationA = new Location(null, 0, 1, 2);
|
||||||
|
Location locationB = new Location(null, 1, 2, 3);
|
||||||
|
|
||||||
|
history.add(locationA);
|
||||||
|
history.add(locationA);
|
||||||
|
history.add(locationB);
|
||||||
|
Assert.assertTrue(history.contains(locationA));
|
||||||
|
Assert.assertTrue(history.contains(locationB));
|
||||||
|
history.add(locationB);
|
||||||
|
Assert.assertFalse(history.contains(locationA));
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,10 @@
|
|||||||
import com.gmail.nossr50.util.blockmeta.*;
|
package com.gmail.nossr50.util.blockmeta;
|
||||||
|
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
Loading…
Reference in New Issue
Block a user