@Test
  public void testNewPacket() {
    IcmpV4ParameterProblemPacket p;
    try {
      p =
          IcmpV4ParameterProblemPacket.newPacket(
              packet.getRawData(), 0, packet.getRawData().length);
    } catch (IllegalRawDataException e) {
      throw new AssertionError(e);
    }
    assertEquals(packet, p);

    assertTrue(p.getPayload().contains(IpV4Packet.class));
    assertTrue(p.getPayload().contains(IcmpV4CommonPacket.class));
    assertTrue(p.getPayload().contains(IcmpV4EchoPacket.class));
    assertFalse(p.getPayload().contains(UnknownPacket.class));
    assertFalse(p.getPayload().contains(IllegalPacket.class));
  }
  @Test
  public void testGetHeader() {
    IcmpV4ParameterProblemHeader h = packet.getHeader();
    assertEquals(pointer, h.getPointer());
    assertEquals(unused, h.getUnused());

    IcmpV4ParameterProblemPacket.Builder b = packet.getBuilder();
    IcmpV4ParameterProblemPacket p;

    b.pointer((byte) 0);
    p = b.build();
    assertEquals((byte) 0, (byte) p.getHeader().getPointerAsInt());

    b.pointer((byte) 50);
    p = b.build();
    assertEquals((byte) 50, (byte) p.getHeader().getPointerAsInt());

    b.pointer((byte) 127);
    p = b.build();
    assertEquals((byte) 127, (byte) p.getHeader().getPointerAsInt());

    b.pointer((byte) -1);
    p = b.build();
    assertEquals((byte) -1, (byte) p.getHeader().getPointerAsInt());

    b.pointer((byte) -128);
    p = b.build();
    assertEquals((byte) -128, (byte) p.getHeader().getPointerAsInt());

    b.unused(0);
    p = b.build();
    assertEquals(0, p.getHeader().getUnused());

    b.unused(1000000);
    p = b.build();
    assertEquals(1000000, p.getHeader().getUnused());

    b.unused(16777215);
    p = b.build();
    assertEquals(16777215, p.getHeader().getUnused());

    b.unused(16777216);
    try {
      p = b.build();
      fail();
    } catch (IllegalArgumentException e) {
    }

    b.unused(-1);
    try {
      p = b.build();
      fail();
    } catch (IllegalArgumentException e) {
    }
  }