2023-02-15 22:27:40 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Mon, 13 Feb 2023 14:14:56 -0800
Subject: [PATCH] Test changes
diff --git a/build.gradle.kts b/build.gradle.kts
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
2023-09-25 01:05:05 +02:00
@@ -0,0 +0,0 @@ tasks.compileJava {
options.setIncremental(false)
}
+// Paper start - compile tests with -parameters for better junit parameterized test names
+tasks.compileTestJava {
+ options.compilerArgs.add("-parameters")
+}
+// Paper end
+
publishing {
publications.create<MavenPublication>("maven") {
artifact(tasks.shadowJar)
2023-10-22 21:12:00 +02:00
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
2023-02-15 22:27:40 +01:00
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
2023-10-22 21:12:00 +02:00
--- a/src/test/java/org/bukkit/support/DummyServer.java
+++ b/src/test/java/org/bukkit/support/DummyServer.java
@@ -0,0 +0,0 @@ public final class DummyServer {
2023-02-15 22:27:40 +01:00
2023-10-22 21:12:00 +02:00
when(instance.getRegistry(any())).then(mock -> CraftRegistry.createRegistry(mock.getArgument(0), AbstractTestingBase.REGISTRY_CUSTOM));
2023-02-15 22:27:40 +01:00
2023-10-22 21:12:00 +02:00
+ // Paper start - testing additions
+ final Thread currentThread = Thread.currentThread();
+ when(instance.isPrimaryThread()).thenAnswer(ignored -> Thread.currentThread().equals(currentThread));
+
+ final org.bukkit.plugin.PluginManager pluginManager = new org.bukkit.plugin.SimplePluginManager(instance, new org.bukkit.command.SimpleCommandMap(instance));
+ when(instance.getPluginManager()).thenReturn(pluginManager);
+ // paper end - testing additions
+
Bukkit.setServer(instance);
} catch (Throwable t) {
throw new Error(t);