Skip to content

Commit

Permalink
fix: Mock server player connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Steveplays28 committed Mar 14, 2024
1 parent d480bfc commit c42b0c0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.github.opencubicchunks.cubicchunks.mixin.test.common.server;

import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.ServerGamePacketListenerImpl;
import org.mockito.Mockito;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

@Mixin(ServerPlayer.class)
public class MixinServerPlayerTest {
@Shadow
@SuppressWarnings("unused")
public ServerGamePacketListenerImpl connection = Mockito.mock();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package io.github.opencubicchunks.cubicchunks.mixin.test.common.server;

import javax.annotation.ParametersAreNonnullByDefault;

import io.github.opencubicchunks.cc_core.annotation.MethodsReturnNonnullByDefault;
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private ServerPlayer setupServerPlayer(ServerLevel serverLevel) {
return new ServerPlayer(mock(RETURNS_DEEP_STUBS), serverLevel, mock(RETURNS_DEEP_STUBS), mock(RETURNS_DEEP_STUBS));
}

// TODO: Stub. This test needs a network connection to work.
// TODO: Stub. Test fails.
@Disabled @Test public void testTeleportToVanilla() throws Exception {
try (CloseableReference<ServerLevel> serverLevelReference = setupServerLevel()) {
ServerPlayer player = setupServerPlayer(serverLevelReference.value());
Expand Down

0 comments on commit c42b0c0

Please sign in to comment.