diff --git a/Core/src/test/java/com/plotsquared/core/configuration/caption/ClickStripTransformTest.java b/Core/src/test/java/com/plotsquared/core/configuration/caption/ClickStripTransformTest.java index eb739a81b..492b54abc 100644 --- a/Core/src/test/java/com/plotsquared/core/configuration/caption/ClickStripTransformTest.java +++ b/Core/src/test/java/com/plotsquared/core/configuration/caption/ClickStripTransformTest.java @@ -30,14 +30,12 @@ import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.HoverEvent; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.TextDecoration; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.util.EnumSet; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNull; class ClickStripTransformTest { @@ -53,7 +51,7 @@ class ClickStripTransformTest { ) ); var transformedComponent = transform.transform(component); - assertNull(transformedComponent.clickEvent()); + Assertions.assertNull(transformedComponent.clickEvent()); } @Test @@ -68,7 +66,7 @@ class ClickStripTransformTest { var component = Component.text("Hello") .clickEvent(originalClickEvent); var transformedComponent = transform.transform(component); - assertEquals(originalClickEvent, transformedComponent.clickEvent()); + Assertions.assertEquals(originalClickEvent, transformedComponent.clickEvent()); } @Test @@ -88,9 +86,9 @@ class ClickStripTransformTest { inner.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, "https://example.org")) ); var transformedComponent = transform.transform(component); - assertFalse(transformedComponent.children().isEmpty()); // child still exists - assertEquals(inner, transformedComponent.children().get(0)); // only the click event has changed - assertNull(transformedComponent.children().get(0).clickEvent()); + Assertions.assertFalse(transformedComponent.children().isEmpty()); // child still exists + Assertions.assertEquals(inner, transformedComponent.children().get(0)); // only the click event has changed + Assertions.assertNull(transformedComponent.children().get(0).clickEvent()); } } diff --git a/Core/src/test/java/com/plotsquared/core/plot/FlagTest.java b/Core/src/test/java/com/plotsquared/core/plot/FlagTest.java index 172a905c3..448f60eff 100644 --- a/Core/src/test/java/com/plotsquared/core/plot/FlagTest.java +++ b/Core/src/test/java/com/plotsquared/core/plot/FlagTest.java @@ -32,10 +32,9 @@ import com.plotsquared.core.plot.flag.implementations.UseFlag; import com.sk89q.worldedit.world.item.ItemType; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class FlagTest { @@ -43,7 +42,7 @@ public class FlagTest { private ItemType testBlock; - @Before + @BeforeEach public void setUp() throws Exception { //EventUtil.manager = new EventUtilTest(); DBFunc.dbManager = new AbstractDBTest(); @@ -72,7 +71,7 @@ public class FlagTest { @Test public void testFlagName() { String flagName = PlotFlag.getFlagName(UseFlag.class); - assertEquals("use", flagName); + Assertions.assertEquals("use", flagName); } } diff --git a/Core/src/test/java/com/plotsquared/core/plot/PlotRangeIteratorTest.java b/Core/src/test/java/com/plotsquared/core/plot/PlotRangeIteratorTest.java index 605e22d7a..e8624b9f8 100644 --- a/Core/src/test/java/com/plotsquared/core/plot/PlotRangeIteratorTest.java +++ b/Core/src/test/java/com/plotsquared/core/plot/PlotRangeIteratorTest.java @@ -25,19 +25,13 @@ */ package com.plotsquared.core.plot; - +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.List; import java.util.NoSuchElementException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; - public class PlotRangeIteratorTest { @Test @@ -45,10 +39,10 @@ public class PlotRangeIteratorTest { // an iterator that should only contain the given plot PlotId id = PlotId.of(3, 7); PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id, id); - assertTrue(range.hasNext()); - assertEquals(id, range.next()); - assertFalse(range.hasNext()); - assertThrows(NoSuchElementException.class, range::next); + Assertions.assertTrue(range.hasNext()); + Assertions.assertEquals(id, range.next()); + Assertions.assertFalse(range.hasNext()); + Assertions.assertThrows(NoSuchElementException.class, range::next); } // the tests below assume a specific order (first increasing y, then increasing x) @@ -63,11 +57,11 @@ public class PlotRangeIteratorTest { List all = Arrays.asList(id00, id01, id10, id11); PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id11); for (PlotId id : all) { - assertTrue(range.hasNext()); - assertEquals(id, range.next()); + Assertions.assertTrue(range.hasNext()); + Assertions.assertEquals(id, range.next()); } - assertFalse(range.hasNext()); - assertThrows(NoSuchElementException.class, range::next); + Assertions.assertFalse(range.hasNext()); + Assertions.assertThrows(NoSuchElementException.class, range::next); } @Test @@ -82,11 +76,11 @@ public class PlotRangeIteratorTest { List all = Arrays.asList(id00, id01, id02, id10, id11, id12); PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id12); for (PlotId id : all) { - assertTrue(range.hasNext()); - assertEquals(id, range.next()); + Assertions.assertTrue(range.hasNext()); + Assertions.assertEquals(id, range.next()); } - assertFalse(range.hasNext()); - assertThrows(NoSuchElementException.class, range::next); + Assertions.assertFalse(range.hasNext()); + Assertions.assertThrows(NoSuchElementException.class, range::next); } @Test @@ -101,11 +95,11 @@ public class PlotRangeIteratorTest { List all = Arrays.asList(id00, id01, id10, id11, id20, id21); PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id21); for (PlotId id : all) { - assertTrue(range.hasNext()); - assertEquals(id, range.next()); + Assertions.assertTrue(range.hasNext()); + Assertions.assertEquals(id, range.next()); } - assertFalse(range.hasNext()); - assertThrows(NoSuchElementException.class, range::next); + Assertions.assertFalse(range.hasNext()); + Assertions.assertThrows(NoSuchElementException.class, range::next); } @Test @@ -115,9 +109,9 @@ public class PlotRangeIteratorTest { PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id01); for (int i = 0; i < 4; i++) { - assertNotEquals(0, range.next().getY()); + Assertions.assertNotEquals(0, range.next().getY()); } - assertFalse(range.hasNext()); - assertThrows(NoSuchElementException.class, range::next); + Assertions.assertFalse(range.hasNext()); + Assertions.assertThrows(NoSuchElementException.class, range::next); } } diff --git a/Core/src/test/java/com/plotsquared/core/plot/PlotVersionTest.java b/Core/src/test/java/com/plotsquared/core/plot/PlotVersionTest.java index e7d8b323d..82457dfdb 100644 --- a/Core/src/test/java/com/plotsquared/core/plot/PlotVersionTest.java +++ b/Core/src/test/java/com/plotsquared/core/plot/PlotVersionTest.java @@ -28,7 +28,7 @@ package com.plotsquared.core.plot; import com.plotsquared.core.PlotVersion; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PlotVersionTest { diff --git a/Core/src/test/java/com/plotsquared/core/synchronization/LockRepositoryTest.java b/Core/src/test/java/com/plotsquared/core/synchronization/LockRepositoryTest.java index f27419bd3..4f473d59e 100644 --- a/Core/src/test/java/com/plotsquared/core/synchronization/LockRepositoryTest.java +++ b/Core/src/test/java/com/plotsquared/core/synchronization/LockRepositoryTest.java @@ -25,6 +25,7 @@ */ package com.plotsquared.core.synchronization; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -32,9 +33,6 @@ import org.junit.jupiter.api.Test; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; - class LockRepositoryTest { private LockKey key; @@ -55,11 +53,9 @@ class LockRepositoryTest { throw new IllegalStateException("Expected a ReentrantLock"); } - assertThrows(IllegalStateException.class, () -> { - this.lockRepository.useLock(this.key, () -> { - throw new IllegalStateException(); - }); - }); - assertFalse(lock.isLocked()); + Assertions.assertThrows(IllegalStateException.class, () -> this.lockRepository.useLock(this.key, () -> { + throw new IllegalStateException(); + })); + Assertions.assertFalse(lock.isLocked()); } } diff --git a/build.gradle.kts b/build.gradle.kts index 54ca07fb4..f7974ad08 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -67,7 +67,6 @@ val javadocDir = rootDir.resolve("docs").resolve("javadoc").resolve(project.name allprojects { dependencies { // Tests - testImplementation("junit:junit:4.13.2") testImplementation("org.junit.jupiter:junit-jupiter:5.8.2") }