Adds more BlockLocation tests
This commit is contained in:
parent
32410a82ba
commit
f0a7ff8c47
@ -4,7 +4,7 @@ import be.seeseemelk.mockbukkit.MockBukkit;
|
|||||||
import be.seeseemelk.mockbukkit.WorldMock;
|
import be.seeseemelk.mockbukkit.WorldMock;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
@ -13,14 +13,13 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
|||||||
public class BlockLocationTest {
|
public class BlockLocationTest {
|
||||||
private WorldMock mockWorld;
|
private WorldMock mockWorld;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
mockWorld = new WorldMock(Material.DIRT, 5);
|
mockWorld = new WorldMock(Material.DIRT, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown()
|
public void tearDown() {
|
||||||
{
|
|
||||||
MockBukkit.unmock();
|
MockBukkit.unmock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,4 +58,27 @@ public class BlockLocationTest {
|
|||||||
assertNotEquals(location1, location2);
|
assertNotEquals(location1, location2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void makeRelativeTest() {
|
||||||
|
BlockLocation location = new BlockLocation(mockWorld, 3, 7, 19);
|
||||||
|
BlockLocation newLocation = location.makeRelative(34, 65, 75);
|
||||||
|
assertEquals(37, newLocation.getBlockX());
|
||||||
|
assertEquals(72, newLocation.getBlockY());
|
||||||
|
assertEquals(94, newLocation.getBlockZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void materialTest() {
|
||||||
|
BlockLocation location = new BlockLocation(mockWorld, 0, 0, 0);
|
||||||
|
assertNotEquals(Material.BOOKSHELF, location.getType());
|
||||||
|
location.setType(Material.BOOKSHELF);
|
||||||
|
assertEquals(Material.BOOKSHELF, location.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void toStringTest() {
|
||||||
|
BlockLocation location = new BlockLocation(mockWorld, 56, 87, 34);
|
||||||
|
assertEquals("56,87,34", location.toString());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user