From 19be2546e60ddff101519d522eed050bbd7a4c78 Mon Sep 17 00:00:00 2001 From: TheMode Date: Fri, 21 Jan 2022 21:06:09 +0100 Subject: [PATCH] Remove scheduling test Signed-off-by: TheMode --- .../minestom/server/ServerProcessTest.java | 33 ++----------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/src/test/java/net/minestom/server/ServerProcessTest.java b/src/test/java/net/minestom/server/ServerProcessTest.java index 90f3c84eb..5b2daa9eb 100644 --- a/src/test/java/net/minestom/server/ServerProcessTest.java +++ b/src/test/java/net/minestom/server/ServerProcessTest.java @@ -1,16 +1,12 @@ package net.minestom.server; -import net.minestom.server.thread.TickSchedulerThread; -import net.minestom.server.timer.TaskSchedule; import org.junit.jupiter.api.Test; import java.net.InetSocketAddress; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertThrows; public class ServerProcessTest { @@ -31,29 +27,4 @@ public class ServerProcessTest { assertDoesNotThrow(() -> ticker.tick(System.currentTimeMillis())); assertDoesNotThrow(process::stop); } - - @Test - public void tickScheduling() { - var process = MinecraftServer.updateProcess(); - process.start(new InetSocketAddress("localhost", 25568)); - AtomicLong time = new AtomicLong(); - AtomicInteger counter = new AtomicInteger(); - - CountDownLatch latch = new CountDownLatch(1); - process.scheduler().scheduleTask(() -> { - long timeNow = System.currentTimeMillis(); - long lastTime = time.get(); - if (lastTime != 0) { - long diff = timeNow - lastTime; - assertEquals(MinecraftServer.TICK_MS, diff, 5); - } - time.set(timeNow); - if (counter.incrementAndGet() == 10) { - process.stop(); - latch.countDown(); - } - }, TaskSchedule.nextTick(), TaskSchedule.nextTick()); - new TickSchedulerThread(process).start(); - assertDoesNotThrow(() -> latch.await()); - } }