mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-24 03:25:29 +01:00
Handle package seal
This commit is contained in:
parent
20247747b5
commit
270cdfca2f
@ -2,8 +2,7 @@ package com.comphenix.protocol.wrappers;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
@ -20,27 +19,36 @@ public class WrappedServerPingTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws IOException {
|
||||
CompressedImage tux = CompressedImage.fromPng(Resources.getResource("tux.png").openStream());
|
||||
byte[] original = tux.getDataCopy();
|
||||
public void test() {
|
||||
try {
|
||||
CompressedImage tux = CompressedImage.fromPng(Resources.getResource("tux.png").openStream());
|
||||
byte[] original = tux.getDataCopy();
|
||||
|
||||
WrappedServerPing serverPing = new WrappedServerPing();
|
||||
serverPing.setMotD("Hello, this is a test.");
|
||||
serverPing.setPlayersOnline(5);
|
||||
serverPing.setPlayersMaximum(10);
|
||||
serverPing.setVersionName("Minecraft 123");
|
||||
serverPing.setVersionProtocol(4);
|
||||
serverPing.setFavicon(tux);
|
||||
WrappedServerPing serverPing = new WrappedServerPing();
|
||||
serverPing.setMotD("Hello, this is a test.");
|
||||
serverPing.setPlayersOnline(5);
|
||||
serverPing.setPlayersMaximum(10);
|
||||
serverPing.setVersionName("Minecraft 123");
|
||||
serverPing.setVersionProtocol(4);
|
||||
serverPing.setFavicon(tux);
|
||||
|
||||
assertEquals(5, serverPing.getPlayersOnline());
|
||||
assertEquals(10, serverPing.getPlayersMaximum());
|
||||
assertEquals("Minecraft 123", serverPing.getVersionName());
|
||||
assertEquals(4, serverPing.getVersionProtocol());
|
||||
assertEquals(5, serverPing.getPlayersOnline());
|
||||
assertEquals(10, serverPing.getPlayersMaximum());
|
||||
assertEquals("Minecraft 123", serverPing.getVersionName());
|
||||
assertEquals(4, serverPing.getVersionProtocol());
|
||||
|
||||
assertArrayEquals(original, serverPing.getFavicon().getData());
|
||||
assertArrayEquals(original, serverPing.getFavicon().getData());
|
||||
|
||||
CompressedImage copy = CompressedImage.fromBase64Png(Base64Coder.encodeLines(tux.getData()));
|
||||
assertArrayEquals(copy.getData(), serverPing.getFavicon().getData());
|
||||
CompressedImage copy = CompressedImage.fromBase64Png(Base64Coder.encodeLines(tux.getData()));
|
||||
assertArrayEquals(copy.getData(), serverPing.getFavicon().getData());
|
||||
} catch (Throwable ex) {
|
||||
if (ex.getCause() instanceof SecurityException) {
|
||||
// There was a global package seal for a while, but not anymore
|
||||
System.err.println("Encountered a SecurityException, update your Spigot jar!");
|
||||
} else {
|
||||
ex.printStackTrace();
|
||||
fail("Encountered an exception testing ServerPing");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user