Updated Upstream (Bukkit/CraftBukkit)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
fb23cbb3 Define surefire plugin version
d022084a Define ordering for MetadataStoreTest
99a7f6f0 PR-910: Match generic max absorption attribute name style with the rest
c7390d71 PR-909: Update tests to JUnit 5

CraftBukkit Changes:
f0661c351 PR-1230: Move unstructured PDC NBT serialisation to SNBT
452fcb599 PR-1256: Update tests to JUnit 5
This commit is contained in:
Nassim Jahnke
2023-09-24 17:16:58 +10:00
parent 63a40050bd
commit 358877e2e2
40 changed files with 292 additions and 295 deletions

View File

@@ -1146,17 +1146,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+import io.papermc.paper.tag.BaseTag;
+import io.papermc.paper.tag.EntityTags;
+import org.bukkit.Bukkit;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.Test;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import org.bukkit.Bukkit;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class MaterialTagsTest extends AbstractTestingBase {
+
@@ -1179,7 +1178,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ private static void testLocked(Class<?> clazz) {
+ for (BaseTag<?, ?> tag : collectTags(clazz)) {
+ assertTrue("Tag " + tag.key() + " is not locked", tag.isLocked());
+ assertTrue(tag.isLocked(), "Tag " + tag.key() + " is not locked");
+ }
+ }
+
@@ -1209,7 +1208,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import java.util.logging.Level;
+import org.bukkit.Bukkit;
+import org.bukkit.support.AbstractTestingBase;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+public class EntityTagsTest extends AbstractTestingBase {
+

View File

@@ -116,10 +116,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import java.time.Duration;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import org.junit.jupiter.api.Test;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class TickTest {
+

View File

@@ -212,8 +212,8 @@ diff --git a/src/test/java/org/bukkit/EffectTest.java b/src/test/java/org/bukkit
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/test/java/org/bukkit/EffectTest.java
+++ b/src/test/java/org/bukkit/EffectTest.java
@@ -0,0 +0,0 @@ import static org.junit.Assert.*;
import org.junit.Test;
@@ -0,0 +0,0 @@ import static org.hamcrest.CoreMatchers.*;
import org.junit.jupiter.api.Test;
public class EffectTest {
+ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); // Paper

View File

@@ -4992,10 +4992,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import java.util.Set;
+import net.kyori.adventure.key.Key;
+import org.bukkit.NamespacedKey;
+import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class KeyTest {
+

View File

@@ -35,8 +35,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end
+
testImplementation("org.apache.commons:commons-lang3:3.12.0")
testImplementation("junit:junit:4.13.2")
testImplementation("org.hamcrest:hamcrest-library:1.3")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
testImplementation("org.hamcrest:hamcrest:2.2")
@@ -0,0 +0,0 @@ tasks.withType<Javadoc> {
options.links(
"https://guava.dev/releases/32.1.2-jre/api/docs/",

View File

@@ -61,8 +61,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ testCompileOnly(annotations)
+
+ testImplementation("org.apache.commons:commons-lang3:3.12.0")
+ testImplementation("junit:junit:4.13.2")
+ testImplementation("org.hamcrest:hamcrest-library:1.3")
+ testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
+ testImplementation("org.hamcrest:hamcrest:2.2")
+ testImplementation("org.mockito:mockito-core:5.5.0")
+ testImplementation("org.ow2.asm:asm-tree:9.5")
+}
@@ -219,15 +219,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- </dependency>
- <!-- testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <version>5.10.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
- <version>1.3</version>
- <artifactId>hamcrest</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
@@ -339,6 +339,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- </tags>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>3.1.0</version>
- </plugin>
- </plugins>
- </build>
-

View File

@@ -1270,7 +1270,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/test/java/org/bukkit/materials/MaterialDataTest.java
@@ -0,0 +0,0 @@ import org.bukkit.material.WoodenStep;
import org.bukkit.material.types.MushroomBlockTexture;
import org.junit.Test;
import org.junit.jupiter.api.Test;
+@Deprecated // Paper
public class MaterialDataTest {

View File

@@ -2284,14 +2284,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
-package org.bukkit.event;
-
-import static org.junit.jupiter.api.Assertions.*;
-import org.bukkit.Bukkit;
-import org.bukkit.plugin.PluginLoader;
-import org.bukkit.plugin.SimplePluginManager;
-import org.bukkit.plugin.TestPlugin;
-import org.bukkit.plugin.java.JavaPluginLoader;
-import org.bukkit.support.AbstractTestingBase;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.jupiter.api.Test;
-
-public class SyntheticEventTest extends AbstractTestingBase {
- @SuppressWarnings("deprecation")
@@ -2312,7 +2312,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- pluginManager.registerEvents(impl, plugin);
- pluginManager.callEvent(event);
-
- Assert.assertEquals(1, impl.callCount);
- assertEquals(1, impl.callCount);
- }
-
- public abstract static class Base<E extends Event> implements Listener {
@@ -2339,15 +2339,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
-package org.bukkit.plugin;
-
-import static org.bukkit.support.MatcherAssert.*;
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
-import org.bukkit.Bukkit;
-import org.bukkit.event.Event;
-import org.bukkit.event.TestEvent;
-import org.bukkit.permissions.Permission;
-import org.bukkit.support.AbstractTestingBase;
-import org.junit.After;
-import org.junit.Test;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-public class PluginManagerTest extends AbstractTestingBase {
- private class MutableObject {
@@ -2503,20 +2503,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- private void testRemovePermissionByName(final String name) {
- final Permission perm = new Permission(name);
- pm.addPermission(perm);
- assertThat("Permission \"" + name + "\" was not added", pm.getPermission(name), is(perm));
- assertThat(pm.getPermission(name), is(perm), "Permission \"" + name + "\" was not added");
- pm.removePermission(name);
- assertThat("Permission \"" + name + "\" was not removed", pm.getPermission(name), is(nullValue()));
- assertThat(pm.getPermission(name), is(nullValue()), "Permission \"" + name + "\" was not removed");
- }
-
- private void testRemovePermissionByPermission(final String name) {
- final Permission perm = new Permission(name);
- pm.addPermission(perm);
- assertThat("Permission \"" + name + "\" was not added", pm.getPermission(name), is(perm));
- assertThat(pm.getPermission(name), is(perm), "Permission \"" + name + "\" was not added");
- pm.removePermission(perm);
- assertThat("Permission \"" + name + "\" was not removed", pm.getPermission(name), is(nullValue()));
- assertThat(pm.getPermission(name), is(nullValue()), "Permission \"" + name + "\" was not removed");
- }
-
- @After
- @AfterEach
- public void tearDown() {
- pm.clearPlugins();
- assertThat(pm.getPermissions(), is(empty()));

View File

@@ -146,8 +146,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ builder.append("\t").append(message).append("\n");
}
- Assert.fail("There " + errors.size() + " are missing annotation(s)");
+ Assert.fail(builder.toString());
- fail("There " + errors.size() + " are missing annotation(s)");
+ fail(builder.toString());
}
private static void collectClasses(@NotNull File from, @NotNull Map<String, ClassNode> to) throws IOException {
@@ -208,14 +208,14 @@ diff --git a/src/test/java/org/bukkit/BukkitMirrorTest.java b/src/test/java/org/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/test/java/org/bukkit/BukkitMirrorTest.java
+++ b/src/test/java/org/bukkit/BukkitMirrorTest.java
@@ -0,0 +0,0 @@ public class BukkitMirrorTest {
@@ -0,0 +0,0 @@ import org.junit.jupiter.params.provider.MethodSource;
public class BukkitMirrorTest {
@Parameters(name = "{index}: {1}")
public static List<Object[]> data() {
+ if (true) return List.of(); // Paper
return Lists.transform(Arrays.asList(Server.class.getDeclaredMethods()), new Function<Method, Object[]>() {
@Override
public Object[] apply(Method input) {
public static Stream<Arguments> data() {
+ if (true) return Stream.of(); // Paper
return Stream.of(Server.class.getDeclaredMethods())
.map(method -> {
try {
diff --git a/src/test/java/org/bukkit/support/TestServer.java b/src/test/java/org/bukkit/support/TestServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/test/java/org/bukkit/support/TestServer.java