From 32410a82ba7917bf7a0c9325400c72a28139eeeb Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Tue, 9 Feb 2021 21:12:43 +0100 Subject: [PATCH] Adds some tests for the equals method of BlockLocationTest --- .../knarcraft/stargate/BlockLocationTest.java | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/test/java/net/knarcraft/stargate/BlockLocationTest.java diff --git a/src/test/java/net/knarcraft/stargate/BlockLocationTest.java b/src/test/java/net/knarcraft/stargate/BlockLocationTest.java new file mode 100644 index 0000000..bc603f6 --- /dev/null +++ b/src/test/java/net/knarcraft/stargate/BlockLocationTest.java @@ -0,0 +1,62 @@ +package net.knarcraft.stargate; + +import be.seeseemelk.mockbukkit.MockBukkit; +import be.seeseemelk.mockbukkit.WorldMock; +import org.bukkit.Material; +import org.junit.After; +import org.junit.Before; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; + +public class BlockLocationTest { + private WorldMock mockWorld; + + @Before + public void setUp() { + mockWorld = new WorldMock(Material.DIRT, 5); + } + + @After + public void tearDown() + { + MockBukkit.unmock(); + } + + @Test + public void equalsTest() { + BlockLocation location1 = new BlockLocation(mockWorld, 1, 3, 4); + BlockLocation location2 = new BlockLocation(mockWorld, 1, 3, 4); + assertEquals(location1, location2); + } + + @Test + public void notEqualsTest1() { + BlockLocation location1 = new BlockLocation(mockWorld, 1, 3, 4); + BlockLocation location2 = new BlockLocation(mockWorld, 2, 3, 4); + assertNotEquals(location1, location2); + } + + @Test + public void notEqualsTest2() { + BlockLocation location1 = new BlockLocation(mockWorld, 1, 3, 4); + BlockLocation location2 = new BlockLocation(mockWorld, 1, 5, 4); + assertNotEquals(location1, location2); + } + + @Test + public void notEqualsTest3() { + BlockLocation location1 = new BlockLocation(mockWorld, 1, 3, 4); + BlockLocation location2 = new BlockLocation(mockWorld, 1, 3, 7); + assertNotEquals(location1, location2); + } + + @Test + public void notEqualsTest4() { + BlockLocation location1 = new BlockLocation(mockWorld, 1, 3, 4); + BlockLocation location2 = new BlockLocation(new WorldMock(Material.DIRT, 4), 1, 3, 4); + assertNotEquals(location1, location2); + } + +}