SPIGOT-7653: Update ApiVersion.CURRENT with latest version and include tests

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot 2024-05-02 07:00:16 +10:00
parent f13c8f9203
commit 23b13ad11a
2 changed files with 12 additions and 2 deletions

View File

@ -15,7 +15,7 @@ public final class ApiVersion implements Comparable<ApiVersion> {
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");

View File

@ -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<Arguments> 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) {