Changed a test to use JUnit's timeout annotation.

This commit is contained in:
Harrison Deng 2020-04-28 23:37:09 -05:00
parent b2efe76e27
commit d62bc696a5

View File

@ -9,8 +9,10 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.bukkit.block.Biome;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.TestInstance.Lifecycle;
import ca.recrown.islandsurvivalcraft.Utilities;
@ -93,18 +95,10 @@ public class UniBiomeIslandGeneratorTest {
}
@Test
@Timeout(value = 1, unit = TimeUnit.MINUTES)
public void testBiomeGenerationSingleThread1608Chunks() {
Runnable g1 = new BiomeGenTask(1608, 0);
ExecutorService ex = Executors.newFixedThreadPool(6);
ex.execute(g1);
try {
ex.shutdown();
assertTrue(ex.awaitTermination(1, TimeUnit.MINUTES));
} catch (InterruptedException e) {
assertFalse(false, e.getCause().getMessage());
}
g1.run();
}
@Test