// Path: src/main/java/com/github/ffalcinelli/jdivert/Util.java
// public static byte[] parseHexBinary(String s) {
//     final int len = s.length();
// 
//     // "111" is not a valid hex encoding.
//     if (len % 2 != 0)
//         throw new IllegalArgumentException("hexBinary needs to be even-length: " + s);
// 
//     byte[] out = new byte[len / 2];
// 
//     for (int i = 0; i < len; i += 2) {
//         int h = hexToBin(s.charAt(i));
//         int l = hexToBin(s.charAt(i + 1));
//         if (h == -1 || l == -1)
//             throw new IllegalArgumentException("contains illegal character for hexBinary: " + s);
// 
//         out[i / 2] = (byte) (h * 16 + l);
//     }
// 
//     return out;
// }


import org.junit.Before;
import org.junit.Test;
import static com.github.ffalcinelli.jdivert.Enums.Protocol.UDP;
import static com.github.ffalcinelli.jdivert.Util.parseHexBinary;
import static org.junit.Assert.*;
    public void buildHeadersBis() {
        Header[] headers = Header.buildHeaders(rawData);
        assertEquals(udp, headers[1]);
    }

    @Test
    public void srcPort() {
        assertEquals(srcPort, udp.getSrcPort());
        udp.setSrcPort(50000);
        assertEquals(50000, udp.getSrcPort());
        assertTrue(udp.toString().contains("srcPort=" + 50000));
    }

    @Test
    public void dstPort() {
        assertEquals(53, udp.getDstPort());
        udp.setDstPort(50000);
        assertEquals(50000, udp.getDstPort());
        assertTrue(udp.toString().contains("dstPort=" + 50000));
    }

    @Test
    public void length() {
        assertEquals(rawData.length - ipHdr.getHeaderLength(), udp.getLength());
        udp.setLength(51234);
        assertEquals(51234, udp.getLength());
    }

    @Test
    public void data() {
// Path: src/main/java/com/github/ffalcinelli/jdivert/Util.java
// public static byte[] parseHexBinary(String s) {
//     final int len = s.length();
// 
//     // "111" is not a valid hex encoding.
//     if (len % 2 != 0)
//         throw new IllegalArgumentException("hexBinary needs to be even-length: " + s);
// 
//     byte[] out = new byte[len / 2];
// 
//     for (int i = 0; i < len; i += 2) {
//         int h = hexToBin(s.charAt(i));
//         int l = hexToBin(s.charAt(i + 1));
//         if (h == -1 || l == -1)
//             throw new IllegalArgumentException("contains illegal character for hexBinary: " + s);
// 
//         out[i / 2] = (byte) (h * 16 + l);
//     }
// 
//     return out;
// }


// Path: src/test/java/com/github/ffalcinelli/jdivert/headers/UDPIPv6TestCase.java
import org.junit.Before;
import org.junit.Test;
import static com.github.ffalcinelli.jdivert.Enums.Protocol.UDP;
import static com.github.ffalcinelli.jdivert.Util.parseHexBinary;
import static org.junit.Assert.*;

    public void buildHeadersBis() {
        Header[] headers = Header.buildHeaders(rawData);
        assertEquals(udp, headers[1]);
    }

    @Test
    public void srcPort() {
        assertEquals(srcPort, udp.getSrcPort());
        udp.setSrcPort(50000);
        assertEquals(50000, udp.getSrcPort());
        assertTrue(udp.toString().contains("srcPort=" + 50000));
    }

    @Test
    public void dstPort() {
        assertEquals(53, udp.getDstPort());
        udp.setDstPort(50000);
        assertEquals(50000, udp.getDstPort());
        assertTrue(udp.toString().contains("dstPort=" + 50000));
    }

    @Test
    public void length() {
        assertEquals(rawData.length - ipHdr.getHeaderLength(), udp.getLength());
        udp.setLength(51234);
        assertEquals(51234, udp.getLength());
    }

    @Test
    public void data() {
        assertArrayEquals(parseHexBinary(payload), udp.getData());