Arreglo en los tests para soportar la nueva libreria de JSON

This commit is contained in:
2025-05-18 18:02:06 +02:00
parent e3ca32610f
commit cbee653ec5

View File

@@ -20,17 +20,25 @@ public class ByteArrayTest {
@Test @Test
public void encodeByteArray() throws JSONException { public void encodeByteArray() throws JSONException {
JSONArray data = new JSONArray();
data.put("abc");
data.put("abc".getBytes(StandardCharsets.UTF_8));
Packet<JSONArray> packet = new Packet<>(Parser.BINARY_EVENT); Packet<JSONArray> packet = new Packet<>(Parser.BINARY_EVENT);
packet.data = new JSONArray(asList("abc", "abc".getBytes(StandardCharsets.UTF_8))); packet.data = data;
packet.id = 23; packet.id = 23;
packet.nsp = "/cool"; packet.nsp = "/cool";
Helpers.testBin(packet); Helpers.testBin(packet);
} }
@Test @Test
public void encodeByteArray2() { public void encodeByteArray2() throws JSONException {
JSONArray data = new JSONArray();
data.put("2");
data.put(new byte[] { 0, 1 });
Packet<JSONArray> packet = new Packet<>(Parser.BINARY_EVENT); Packet<JSONArray> packet = new Packet<>(Parser.BINARY_EVENT);
packet.data = new JSONArray(asList("2", new byte[] { 0, 1 })); packet.data = data;
packet.id = 0; packet.id = 0;
packet.nsp = "/"; packet.nsp = "/";
Helpers.testBin(packet); Helpers.testBin(packet);