From 64d58248d681c0ebba5305ad88ff2d6da98243e4 Mon Sep 17 00:00:00 2001 From: Alex <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Thu, 23 Nov 2023 08:22:23 +0100 Subject: [PATCH] Update dependencies (#763) * Update dependencies * Use static imports for Assertions * Change commit hash from jitpack --- README.md | 2 +- pom.xml | 83 +++++++++---------- .../data/DefaultComponentSerializer.java | 2 +- .../game/level/event/BreakBlockEventData.java | 2 +- .../github/steveice10/packetlib/Server.java | 5 +- .../mc/protocol/MinecraftProtocolTest.java | 24 +++--- .../mc/protocol/data/ChunkTest.java | 17 ++-- .../mc/protocol/data/NetworkDataTests.java | 7 +- .../mc/protocol/packet/PacketTest.java | 6 +- .../ClientIntentionPacketTest.java | 4 +- .../ClientboundCommandsPacketTest.java | 4 +- .../clientbound/ServerDeclareRecipesTest.java | 10 +-- .../ClientboundBlockUpdatePacketTest.java | 4 +- ...entboundLevelChunkWithLightPacketTest.java | 6 +- ...entboundSectionBlocksUpdatePacketTest.java | 4 +- .../ClientboundSetEntityDataPacketTest.java | 4 +- .../ClientboundSetEquipmentPacketTest.java | 4 +- .../ClientboundSetPlayerTeamPacketTest.java | 4 +- .../ClientboundCustomQueryPacketTest.java | 4 +- .../ClientboundGameProfilePacketTest.java | 4 +- .../ClientboundHelloPacketTest.java | 4 +- ...ClientboundLoginCompressionPacketTest.java | 4 +- .../ClientboundLoginDisconnectPacketTest.java | 4 +- ...erverboundCustomQueryAnswerPacketTest.java | 4 +- .../ServerboundHelloPacketTest.java | 4 +- .../serverbound/ServerboundKeyPacketTest.java | 13 ++- .../ClientboundPongResponsePacketTest.java | 4 +- .../ClientboundStatusResponsePacketTest.java | 4 +- .../ServerboundPingRequestPacketTest.java | 4 +- .../ServerboundStatusRequestPacketTest.java | 4 +- 30 files changed, 124 insertions(+), 125 deletions(-) diff --git a/README.md b/README.md index 9c741ae5..4f34fde2 100644 --- a/README.md +++ b/README.md @@ -55,4 +55,4 @@ Please join [the GeyserMC Discord server](https://discord.gg/geysermc) and visit ## License -MCProtocolLib is licensed under the **[MIT license](http://www.opensource.org/licenses/mit-license.html)**. +MCProtocolLib is licensed under the **[MIT license](https://opensource.org/license/mit/)**. diff --git a/pom.xml b/pom.xml index 3909661e..35412744 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ MCProtocolLib MCProtocolLib is a simple library for communicating with Minecraft clients and servers. - http://github.com/GeyserMC/MCProtocolLib/ + https://github.com/GeyserMC/MCProtocolLib/ scm:git:git@github.com:GeyserMC/MCProtocolLib.git @@ -20,15 +20,15 @@ UTF-8 - 1.8 - 4.9.3 - + 1.8 + 1.8 + 4.14.0 MIT - http://www.opensource.org/licenses/mit-license.html + https://opensource.org/license/mit/ repo @@ -81,6 +81,7 @@ + com.github.steveice10 opennbt @@ -90,9 +91,10 @@ com.github.GeyserMC mcauthlib - 6f3d6aada5 + 6621fd081c compile + net.kyori adventure-text-serializer-gson @@ -105,12 +107,20 @@ ${adventure.version} compile + org.projectlombok lombok - 1.18.22 + 1.18.30 provided + + com.github.spotbugs + spotbugs-annotations + 4.7.3 + provided + + org.cloudburstmc.math api @@ -123,48 +133,45 @@ 2.0 compile + com.nukkitx.fastutil fastutil-object-int-maps - 8.5.2 + 8.5.3 compile - junit - junit - 4.13.1 - test + com.nukkitx.fastutil + fastutil-int-object-maps + 8.5.3 + compile + io.netty netty-all - 4.1.66.Final + 4.1.99.Final compile io.netty netty-codec-haproxy - 4.1.66.Final + 4.1.99.Final compile true io.netty.incubator netty-incubator-transport-native-io_uring - 0.0.8.Final + 0.0.23.Final linux-x86_64 + - com.github.spotbugs - spotbugs-annotations - 4.3.0 - provided - - - com.nukkitx.fastutil - fastutil-int-object-maps - 8.5.2 - compile + org.junit.jupiter + junit-jupiter + 5.8.2 + test @@ -174,40 +181,32 @@ org.apache.maven.plugins maven-clean-plugin - 3.0.0 + 3.3.1 org.apache.maven.plugins maven-resources-plugin - 3.0.2 + 3.3.1 org.apache.maven.plugins maven-jar-plugin - 3.0.2 + 3.3.0 org.apache.maven.plugins maven-compiler-plugin - 3.7.0 - - ${jdk.version} - ${jdk.version} - + 3.11.0 org.apache.maven.plugins maven-surefire-plugin - 2.22.0 - - - -Dfile.encoding=${project.build.sourceEncoding} @{argLine} - + 3.1.2 org.apache.maven.plugins maven-javadoc-plugin - 3.0.1 + 3.6.0 attach-javadocs @@ -225,7 +224,7 @@ org.apache.maven.plugins maven-source-plugin - 3.0.1 + 3.3.0 attach-sources @@ -238,12 +237,12 @@ org.apache.maven.plugins maven-install-plugin - 2.5.2 + 3.1.1 org.apache.maven.plugins maven-deploy-plugin - 2.8.2 + 3.1.1 diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/DefaultComponentSerializer.java b/src/main/java/com/github/steveice10/mc/protocol/data/DefaultComponentSerializer.java index eb36c4dd..42426275 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/DefaultComponentSerializer.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/DefaultComponentSerializer.java @@ -1,7 +1,7 @@ package com.github.steveice10.mc.protocol.data; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; -import net.kyori.adventure.text.serializer.gson.legacyimpl.NBTLegacyHoverEventSerializer; +import net.kyori.adventure.text.serializer.json.legacyimpl.NBTLegacyHoverEventSerializer; public final class DefaultComponentSerializer { private static GsonComponentSerializer serializer = GsonComponentSerializer.builder() diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/level/event/BreakBlockEventData.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/level/event/BreakBlockEventData.java index 55db3152..e46e1969 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/level/event/BreakBlockEventData.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/level/event/BreakBlockEventData.java @@ -7,5 +7,5 @@ import lombok.NonNull; @Data @AllArgsConstructor public class BreakBlockEventData implements LevelEventData { - private final @NonNull int blockState; + private final int blockState; } diff --git a/src/main/java/com/github/steveice10/packetlib/Server.java b/src/main/java/com/github/steveice10/packetlib/Server.java index 3891d819..d0311ae5 100644 --- a/src/main/java/com/github/steveice10/packetlib/Server.java +++ b/src/main/java/com/github/steveice10/packetlib/Server.java @@ -74,7 +74,6 @@ public interface Server { * @return Value of the flag. * @throws IllegalStateException If the flag's value isn't of the required type. */ - @SuppressWarnings("unchecked") T getGlobalFlag(String key, T def); /** @@ -116,6 +115,8 @@ public interface Server { /** * Binds the listener to its host and port. + * + * @return The server. */ AbstractServer bind(); @@ -123,6 +124,7 @@ public interface Server { * Binds the listener to its host and port. * * @param wait Whether to wait for the listener to finish binding. + * @return The server. */ AbstractServer bind(boolean wait); @@ -131,6 +133,7 @@ public interface Server { * * @param wait Whether to wait for the listener to finish binding. * @param callback Callback to call when the listener has finished binding. + * @return The server. */ AbstractServer bind(boolean wait, Runnable callback); diff --git a/src/test/java/com/github/steveice10/mc/protocol/MinecraftProtocolTest.java b/src/test/java/com/github/steveice10/mc/protocol/MinecraftProtocolTest.java index d36e0e80..d63b698f 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/MinecraftProtocolTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/MinecraftProtocolTest.java @@ -17,9 +17,9 @@ import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.tcp.TcpClientSession; import com.github.steveice10.packetlib.tcp.TcpServer; import net.kyori.adventure.text.Component; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.concurrent.CountDownLatch; @@ -30,9 +30,7 @@ import static com.github.steveice10.mc.protocol.MinecraftConstants.SERVER_INFO_H import static com.github.steveice10.mc.protocol.MinecraftConstants.SERVER_LOGIN_HANDLER_KEY; import static com.github.steveice10.mc.protocol.MinecraftConstants.VERIFY_USERS_KEY; import static java.util.concurrent.TimeUnit.SECONDS; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.*; public class MinecraftProtocolTest { private static final String HOST = "localhost"; @@ -49,7 +47,7 @@ public class MinecraftProtocolTest { private static Server server; - @BeforeClass + @BeforeAll public static void setupServer() { server = new TcpServer(HOST, PORT, MinecraftProtocol::new); server.setGlobalFlag(VERIFY_USERS_KEY, false); @@ -66,10 +64,10 @@ public class MinecraftProtocolTest { session.send(JOIN_GAME_PACKET); }); - assertTrue("Could not bind server.", server.bind(true).isListening()); + assertTrue(server.bind(true).isListening(), "Could not bind server."); } - @AfterClass + @AfterAll public static void tearDownServer() { if (server != null) { server.close(true); @@ -87,8 +85,8 @@ public class MinecraftProtocolTest { session.connect(); handler.status.await(4, SECONDS); - assertNotNull("Failed to get server info.", handler.info); - assertEquals("Received incorrect server info.", SERVER_INFO, handler.info); + assertNotNull(handler.info, "Failed to get server info."); + assertEquals(SERVER_INFO, handler.info, "Received incorrect server info."); } finally { session.disconnect("Status test complete."); } @@ -104,8 +102,8 @@ public class MinecraftProtocolTest { session.connect(); listener.login.await(4, SECONDS); - assertNotNull("Failed to log in.", listener.packet); - assertEquals("Received incorrect join packet.", JOIN_GAME_PACKET, listener.packet); + assertNotNull(listener.packet, "Failed to log in."); + assertEquals(JOIN_GAME_PACKET, listener.packet, "Received incorrect join packet."); } finally { session.disconnect("Login test complete."); } diff --git a/src/test/java/com/github/steveice10/mc/protocol/data/ChunkTest.java b/src/test/java/com/github/steveice10/mc/protocol/data/ChunkTest.java index b56adcc8..a636aa50 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/data/ChunkTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/data/ChunkTest.java @@ -8,19 +8,21 @@ import com.github.steveice10.mc.protocol.data.game.chunk.palette.SingletonPalett import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import it.unimi.dsi.fastutil.ints.Int2ObjectMaps; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; + public class ChunkTest { private final List chunkSectionsToTest = new ArrayList<>(); - @Before + @BeforeEach public void setup() { chunkSectionsToTest.add(new ChunkSection()); @@ -49,7 +51,8 @@ public class ChunkTest { e.printStackTrace(); throw e; } - Assert.assertEquals("Decoded packet does not match original: " + section + " vs " + decoded, section, decoded); + + assertEquals(section, decoded, "Decoded packet does not match original: " + section + " vs " + decoded); } } @@ -57,10 +60,10 @@ public class ChunkTest { public void testDeepCopy() { for (ChunkSection section : chunkSectionsToTest) { ChunkSection copy = new ChunkSection(section); - Assert.assertEquals("Deep copy does not match original: " + section + " vs " + copy, section, copy); + assertEquals(section, copy, "Deep copy does not match original: " + section + " vs " + copy); copy.setBlock(1, 1, 1, 10); - Assert.assertNotEquals("Deep copy is not deep: " + section + " vs " + copy, section, copy); + assertNotEquals(section, copy, "Deep copy is not deep: " + section + " vs " + copy); } } } diff --git a/src/test/java/com/github/steveice10/mc/protocol/data/NetworkDataTests.java b/src/test/java/com/github/steveice10/mc/protocol/data/NetworkDataTests.java index 5446e9f8..68e2a9fa 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/data/NetworkDataTests.java +++ b/src/test/java/com/github/steveice10/mc/protocol/data/NetworkDataTests.java @@ -5,11 +5,12 @@ import com.github.steveice10.mc.protocol.data.game.entity.Effect; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import it.unimi.dsi.fastutil.ints.Int2ObjectMaps; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Collections; +import static org.junit.jupiter.api.Assertions.assertEquals; + /** * Miscellaneous tests for reading and writing classes to/from the network */ @@ -22,7 +23,7 @@ public class NetworkDataTests { ByteBuf buf = Unpooled.buffer(); helper.writeEffect(buf, effect); - Assert.assertEquals(effect, helper.readEffect(buf)); + assertEquals(effect, helper.readEffect(buf)); } } } diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/PacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/PacketTest.java index ae118883..f3d412f4 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/PacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/PacketTest.java @@ -6,12 +6,12 @@ import com.github.steveice10.packetlib.packet.Packet; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import it.unimi.dsi.fastutil.ints.Int2ObjectMaps; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.lang.reflect.Constructor; import java.util.Collections; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public abstract class PacketTest { private MinecraftPacket[] packets; @@ -29,7 +29,7 @@ public abstract class PacketTest { Packet decoded = this.createPacket(packet.getClass(), helper, buf); - assertEquals("Decoded packet does not match original: " + packet + " vs " + decoded, packet, decoded); + assertEquals(packet, decoded, "Decoded packet does not match original: " + packet + " vs " + decoded); } } diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/handshake/serverbound/ClientIntentionPacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/handshake/serverbound/ClientIntentionPacketTest.java index daac3b20..b77bf540 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/handshake/serverbound/ClientIntentionPacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/handshake/serverbound/ClientIntentionPacketTest.java @@ -4,13 +4,13 @@ import com.github.steveice10.mc.protocol.codec.MinecraftCodec; import com.github.steveice10.mc.protocol.codec.MinecraftPacket; import com.github.steveice10.mc.protocol.data.handshake.HandshakeIntent; import com.github.steveice10.mc.protocol.packet.PacketTest; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import java.util.ArrayList; import java.util.List; public class ClientIntentionPacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { List packets = new ArrayList<>(); for (HandshakeIntent intent : HandshakeIntent.values()) { diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundCommandsPacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundCommandsPacketTest.java index c33ec309..78cebbbc 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundCommandsPacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ClientboundCommandsPacketTest.java @@ -7,12 +7,12 @@ import com.github.steveice10.mc.protocol.data.game.command.SuggestionType; import com.github.steveice10.mc.protocol.data.game.command.properties.DoubleProperties; import com.github.steveice10.mc.protocol.data.game.command.properties.StringProperties; import com.github.steveice10.mc.protocol.packet.PacketTest; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import java.util.OptionalInt; public class ClientboundCommandsPacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { this.setPackets(new ClientboundCommandsPacket( new CommandNode[]{ diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ServerDeclareRecipesTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ServerDeclareRecipesTest.java index 848d35fa..7f1e47c8 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ServerDeclareRecipesTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/ServerDeclareRecipesTest.java @@ -5,16 +5,12 @@ import com.github.steveice10.mc.protocol.data.game.recipe.CraftingBookCategory; import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient; import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; -import com.github.steveice10.mc.protocol.data.game.recipe.data.CookedRecipeData; -import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapedRecipeData; -import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapelessRecipeData; -import com.github.steveice10.mc.protocol.data.game.recipe.data.SmithingTransformRecipeData; -import com.github.steveice10.mc.protocol.data.game.recipe.data.StoneCuttingRecipeData; +import com.github.steveice10.mc.protocol.data.game.recipe.data.*; import com.github.steveice10.mc.protocol.packet.PacketTest; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class ServerDeclareRecipesTest extends PacketTest { - @Before + @BeforeEach public void setup() { this.setPackets( new ClientboundUpdateRecipesPacket( diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundBlockUpdatePacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundBlockUpdatePacketTest.java index afbeed03..109971e7 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundBlockUpdatePacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundBlockUpdatePacketTest.java @@ -3,10 +3,10 @@ package com.github.steveice10.mc.protocol.packet.ingame.clientbound.level; import com.github.steveice10.mc.protocol.data.game.level.block.BlockChangeEntry; import com.github.steveice10.mc.protocol.packet.PacketTest; import org.cloudburstmc.math.vector.Vector3i; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class ClientboundBlockUpdatePacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { this.setPackets( new ClientboundBlockUpdatePacket(new BlockChangeEntry( diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundLevelChunkWithLightPacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundLevelChunkWithLightPacketTest.java index 2f4ca009..be1f43e6 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundLevelChunkWithLightPacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundLevelChunkWithLightPacketTest.java @@ -5,14 +5,14 @@ import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityInfo; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.mc.protocol.packet.PacketTest; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import java.io.IOException; import java.util.BitSet; import java.util.Collections; public class ClientboundLevelChunkWithLightPacketTest extends PacketTest { - @Before + @BeforeEach public void setup() throws IOException { this.setPackets( new ClientboundLevelChunkWithLightPacket(0, 0, @@ -26,4 +26,4 @@ public class ClientboundLevelChunkWithLightPacketTest extends PacketTest { ) ); } -} \ No newline at end of file +} diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSectionBlocksUpdatePacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSectionBlocksUpdatePacketTest.java index b16b5e8f..2c973dcf 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSectionBlocksUpdatePacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSectionBlocksUpdatePacketTest.java @@ -3,11 +3,11 @@ package com.github.steveice10.mc.protocol.packet.ingame.clientbound.level; import com.github.steveice10.mc.protocol.data.game.level.block.BlockChangeEntry; import com.github.steveice10.mc.protocol.packet.PacketTest; import org.cloudburstmc.math.vector.Vector3i; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class ClientboundSectionBlocksUpdatePacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { this.setPackets( new ClientboundSectionBlocksUpdatePacket(3, 4, 12, new BlockChangeEntry(Vector3i.from(50, 65, 200), 3)) diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSetEntityDataPacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSetEntityDataPacketTest.java index a112d2d5..ba6b2241 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSetEntityDataPacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSetEntityDataPacketTest.java @@ -12,13 +12,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; import com.github.steveice10.mc.protocol.packet.PacketTest; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEntityDataPacket; import org.cloudburstmc.math.vector.Vector3i; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import java.util.OptionalInt; public class ClientboundSetEntityDataPacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { this.setPackets( new ClientboundSetEntityDataPacket(0, new EntityMetadata[0]), diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSetEquipmentPacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSetEquipmentPacketTest.java index 7336070a..44c57078 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSetEquipmentPacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSetEquipmentPacketTest.java @@ -5,11 +5,11 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.Equipment; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.packet.PacketTest; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEquipmentPacket; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class ClientboundSetEquipmentPacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { this.setPackets( new ClientboundSetEquipmentPacket(1, new Equipment[]{ diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSetPlayerTeamPacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSetPlayerTeamPacketTest.java index 692fa4b1..5a39f99b 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSetPlayerTeamPacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/ingame/clientbound/level/ClientboundSetPlayerTeamPacketTest.java @@ -6,11 +6,11 @@ import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; import com.github.steveice10.mc.protocol.packet.PacketTest; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetPlayerTeamPacket; import net.kyori.adventure.text.Component; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class ClientboundSetPlayerTeamPacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { // Test nameTagVisibility and collisionRule encoding/decoding this.setPackets( diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundCustomQueryPacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundCustomQueryPacketTest.java index 7e314030..c8b04130 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundCustomQueryPacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundCustomQueryPacketTest.java @@ -1,12 +1,12 @@ package com.github.steveice10.mc.protocol.packet.login.clientbound; import com.github.steveice10.mc.protocol.packet.PacketTest; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import java.util.Random; public class ClientboundCustomQueryPacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { byte[] data = new byte[1024]; new Random().nextBytes(data); diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundGameProfilePacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundGameProfilePacketTest.java index 150c018c..849a137f 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundGameProfilePacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundGameProfilePacketTest.java @@ -2,12 +2,12 @@ package com.github.steveice10.mc.protocol.packet.login.clientbound; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.packet.PacketTest; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import java.util.UUID; public class ClientboundGameProfilePacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { this.setPackets(new ClientboundGameProfilePacket(new GameProfile(UUID.randomUUID(), "Username"))); } diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundHelloPacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundHelloPacketTest.java index aaa43ad8..56ea8ca0 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundHelloPacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundHelloPacketTest.java @@ -1,7 +1,7 @@ package com.github.steveice10.mc.protocol.packet.login.clientbound; import com.github.steveice10.mc.protocol.packet.PacketTest; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import java.security.KeyPair; import java.security.KeyPairGenerator; @@ -9,7 +9,7 @@ import java.security.NoSuchAlgorithmException; import java.util.Random; public class ClientboundHelloPacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { KeyPair keyPair; try { diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundLoginCompressionPacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundLoginCompressionPacketTest.java index 88cedfda..19de6869 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundLoginCompressionPacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundLoginCompressionPacketTest.java @@ -1,10 +1,10 @@ package com.github.steveice10.mc.protocol.packet.login.clientbound; import com.github.steveice10.mc.protocol.packet.PacketTest; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class ClientboundLoginCompressionPacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { this.setPackets(new ClientboundLoginCompressionPacket(1)); } diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundLoginDisconnectPacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundLoginDisconnectPacketTest.java index 7970dd7d..05ec9e19 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundLoginDisconnectPacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/login/clientbound/ClientboundLoginDisconnectPacketTest.java @@ -2,10 +2,10 @@ package com.github.steveice10.mc.protocol.packet.login.clientbound; import com.github.steveice10.mc.protocol.packet.PacketTest; import net.kyori.adventure.text.Component; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class ClientboundLoginDisconnectPacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { this.setPackets(new ClientboundLoginDisconnectPacket("Message"), new ClientboundLoginDisconnectPacket(Component.text("Message"))); diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundCustomQueryAnswerPacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundCustomQueryAnswerPacketTest.java index 7c2594a8..8ec65e7c 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundCustomQueryAnswerPacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundCustomQueryAnswerPacketTest.java @@ -1,12 +1,12 @@ package com.github.steveice10.mc.protocol.packet.login.serverbound; import com.github.steveice10.mc.protocol.packet.PacketTest; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import java.util.Random; public class ServerboundCustomQueryAnswerPacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { byte[] data = new byte[1024]; new Random().nextBytes(data); diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundHelloPacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundHelloPacketTest.java index ef960add..0c8c3afc 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundHelloPacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundHelloPacketTest.java @@ -1,12 +1,12 @@ package com.github.steveice10.mc.protocol.packet.login.serverbound; import com.github.steveice10.mc.protocol.packet.PacketTest; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import java.util.UUID; public class ServerboundHelloPacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { this.setPackets(new ServerboundHelloPacket("Username", UUID.randomUUID())); } diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundKeyPacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundKeyPacketTest.java index b54c3db9..ed54b69c 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundKeyPacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/login/serverbound/ServerboundKeyPacketTest.java @@ -1,8 +1,8 @@ package com.github.steveice10.mc.protocol.packet.login.serverbound; import com.github.steveice10.mc.protocol.packet.PacketTest; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; @@ -11,8 +11,7 @@ import java.security.KeyPairGenerator; import java.security.NoSuchAlgorithmException; import java.util.Random; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.*; public class ServerboundKeyPacketTest extends PacketTest { private KeyPair keyPair; @@ -20,7 +19,7 @@ public class ServerboundKeyPacketTest extends PacketTest { private ServerboundKeyPacket packet; private byte[] verifyToken; - @Before + @BeforeEach public void setup() { try { KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA"); @@ -43,7 +42,7 @@ public class ServerboundKeyPacketTest extends PacketTest { @Test public void testEncryptionResponsePacketGetters() { - assertEquals("Secret key does not match.", this.secretKey, this.packet.getSecretKey(this.keyPair.getPrivate())); - assertArrayEquals("Verify token does not match.", this.verifyToken, this.packet.getEncryptedChallenge(this.keyPair.getPrivate())); + assertEquals(this.secretKey, this.packet.getSecretKey(this.keyPair.getPrivate()), "Secret key does not match."); + assertArrayEquals(this.verifyToken, this.packet.getEncryptedChallenge(this.keyPair.getPrivate()), "Verify token does not match."); } } diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/status/clientbound/ClientboundPongResponsePacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/status/clientbound/ClientboundPongResponsePacketTest.java index 841f0b04..1da3fc80 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/status/clientbound/ClientboundPongResponsePacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/status/clientbound/ClientboundPongResponsePacketTest.java @@ -1,10 +1,10 @@ package com.github.steveice10.mc.protocol.packet.status.clientbound; import com.github.steveice10.mc.protocol.packet.PacketTest; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class ClientboundPongResponsePacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { this.setPackets(new ClientboundPongResponsePacket(System.currentTimeMillis())); } diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/status/clientbound/ClientboundStatusResponsePacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/status/clientbound/ClientboundStatusResponsePacketTest.java index 4c1064e3..6904ade7 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/status/clientbound/ClientboundStatusResponsePacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/status/clientbound/ClientboundStatusResponsePacketTest.java @@ -7,14 +7,14 @@ import com.github.steveice10.mc.protocol.data.status.ServerStatusInfo; import com.github.steveice10.mc.protocol.data.status.VersionInfo; import com.github.steveice10.mc.protocol.packet.PacketTest; import net.kyori.adventure.text.Component; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import java.util.ArrayList; import java.util.Collections; import java.util.UUID; public class ClientboundStatusResponsePacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { this.setPackets(new ClientboundStatusResponsePacket( new ServerStatusInfo( diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/status/serverbound/ServerboundPingRequestPacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/status/serverbound/ServerboundPingRequestPacketTest.java index 1aa0ddba..5b58977a 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/status/serverbound/ServerboundPingRequestPacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/status/serverbound/ServerboundPingRequestPacketTest.java @@ -1,10 +1,10 @@ package com.github.steveice10.mc.protocol.packet.status.serverbound; import com.github.steveice10.mc.protocol.packet.PacketTest; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class ServerboundPingRequestPacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { this.setPackets(new ServerboundPingRequestPacket(System.currentTimeMillis())); } diff --git a/src/test/java/com/github/steveice10/mc/protocol/packet/status/serverbound/ServerboundStatusRequestPacketTest.java b/src/test/java/com/github/steveice10/mc/protocol/packet/status/serverbound/ServerboundStatusRequestPacketTest.java index 1fa304e5..c6b7930c 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/packet/status/serverbound/ServerboundStatusRequestPacketTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/packet/status/serverbound/ServerboundStatusRequestPacketTest.java @@ -1,10 +1,10 @@ package com.github.steveice10.mc.protocol.packet.status.serverbound; import com.github.steveice10.mc.protocol.packet.PacketTest; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class ServerboundStatusRequestPacketTest extends PacketTest { - @Before + @BeforeEach public void setup() { this.setPackets(new ServerboundStatusRequestPacket()); }