import me.jesensky.dan.playertracker.exceptions.InvalidPacketException;
import me.jesensky.dan.playertracker.net.packets.Packet;
import me.jesensky.dan.playertracker.net.packets.PacketType;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.io.UnsupportedEncodingException;

@RunWith(JUnit4.class)
public class TestPacket {
    @Test
    public void packetHeader() throws InvalidPacketException {
        Packet packet = new Packet(PacketType.LOGIN, new byte[]{3, 4, 6, 3, 1, 6});
        Assert.assertEquals(packet.getType(), PacketType.LOGIN);
    }

    @Test
    public void _packetHeader() throws InvalidPacketException {
        Packet packet = new Packet(PacketType.LOGIN, new byte[]{3, 4, 6, 3, 1, 6});
        Assert.assertArrayEquals(packet.getType().getHeader(), new byte[]{1, 0, 1});
    }

    @Test
    public void ammendedData() throws InvalidPacketException {
        Packet packet = new Packet(PacketType.LOGIN, new byte[]{3, 4, 6, 3, 1, 6});
        Assert.assertArrayEquals(packet.getAmmendedData(), new byte[]{1, 0, 1, 3, 4, 6, 3, 1, 6});
    }

    @Test
    public void ensureNoBytesMatchDataSeparator() throws UnsupportedEncodingException{
        byte[] bytes = "asdfghjkl;'zxcvbnm,./][poiuytrewq\\+_-=)0(9*&^%$#@!~`12345678{}|:\"<>?".getBytes("UTF-8");
        for(byte b : bytes)
            if(b == 0)
                Assert.fail();
    }
}
@@ -1326,16 +1326,17 @@
 %7D%7C:%5C%22%3C%3E?
+ 
 %22.getByt
@@ -1435,10 +1435,454 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void testDataSection() throws InvalidPacketException%7B%0A        Packet packet = new Packet(PacketType.LOGIN, new byte%5B%5D%7B0x2, 0x6, 0x0, 0x9, 0x4, 0x0, 0x5, 0x2, 0x3%7D);%0A        Assert.assertArrayEquals(new byte%5B%5D%7B0x2, 0x6%7D, packet.getDataSection(0));%0A        Assert.assertArrayEquals(new byte%5B%5D%7B0x9, 0x4%7D, packet.getDataSection(1));%0A        Assert.assertArrayEquals(new byte%5B%5D%7B0x5, 0x2, 0x3%7D, packet.getDataSection(2));%0A    %7D
 %0A%7D

Add packet unit test