From 23b13ad11a4b3193132e0fd73f4677d583ec0220 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 2 May 2024 07:00:16 +1000 Subject: [PATCH] SPIGOT-7653: Update ApiVersion.CURRENT with latest version and include tests By: Doc --- .../java/org/bukkit/craftbukkit/util/ApiVersion.java | 2 +- .../org/bukkit/craftbukkit/util/ApiVersionTest.java | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/util/ApiVersion.java b/paper-server/src/main/java/org/bukkit/craftbukkit/util/ApiVersion.java index 689fdd4c51..d1fc742616 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/util/ApiVersion.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/util/ApiVersion.java @@ -15,7 +15,7 @@ public final class ApiVersion implements Comparable { static { versions = new HashMap<>(); - CURRENT = getOrCreateVersion("1.20.5"); + CURRENT = getOrCreateVersion("1.20.6"); FLATTENING = getOrCreateVersion("1.13"); FIELD_NAME_PARITY = getOrCreateVersion("1.20.5"); NONE = getOrCreateVersion("none"); diff --git a/paper-server/src/test/java/org/bukkit/craftbukkit/util/ApiVersionTest.java b/paper-server/src/test/java/org/bukkit/craftbukkit/util/ApiVersionTest.java index 0aa3ec0356..42ecc28d1b 100644 --- a/paper-server/src/test/java/org/bukkit/craftbukkit/util/ApiVersionTest.java +++ b/paper-server/src/test/java/org/bukkit/craftbukkit/util/ApiVersionTest.java @@ -2,12 +2,14 @@ package org.bukkit.craftbukkit.util; import static org.junit.jupiter.api.Assertions.*; import java.util.stream.Stream; +import net.minecraft.SharedConstants; +import org.bukkit.support.AbstractTestingBase; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -public class ApiVersionTest { +public class ApiVersionTest extends AbstractTestingBase { public static Stream parseData() { return Stream.of( @@ -62,6 +64,14 @@ public class ApiVersionTest { ); } + @Test + public void testCurrentVersionUpdated() { + ApiVersion apiVersionOne = ApiVersion.getOrCreateVersion(SharedConstants.getCurrentVersion().getName()); + ApiVersion apiVersionTwo = ApiVersion.CURRENT; + + assertEquals(apiVersionOne, apiVersionTwo, "The current version in ApiVersion not match current minecraft version"); + } + @ParameterizedTest @MethodSource("parseData") public void testParsing(String parse, String expected) {