@Test
public void testLongSectionAcrossFourPackets() {

  packetPayload[0] = 13; // The first packet includes a pointer_field.
  insertTableSection(1, (byte) 106, 10); // First section. Should be skipped.
  // Second section spread across four packets. Should be consumed.
  insertTableSection(14, (byte) 107, 300);
  packetPayload[300] = 17; // The third packet includes a pointer_field.
  // Third section, at the payload start of the fourth packet. Should be consumed.
  insertTableSection(318, (byte) 108, 10);
  ParsableByteArray firstPacket = new ParsableByteArray(packetPayload, 100);
  reader.consume(firstPacket, FLAG_PAYLOAD_UNIT_START_INDICATOR);
  assertThat(payloadReader.parsedTableIds).isEmpty();
  ParsableByteArray secondPacket = new ParsableByteArray(packetPayload, 200);
  secondPacket.setPosition(100);
  reader.consume(secondPacket, /* flags= */ 0);
  assertThat(payloadReader.parsedTableIds).isEmpty();
  ParsableByteArray thirdPacket = new ParsableByteArray(packetPayload, 300);
  thirdPacket.setPosition(200);
  reader.consume(thirdPacket, /* flags= */ 0);
  assertThat(payloadReader.parsedTableIds).isEmpty();
  ParsableByteArray fourthPacket = new ParsableByteArray(packetPayload);
  fourthPacket.setPosition(300);
  reader.consume(fourthPacket, FLAG_PAYLOAD_UNIT_START_INDICATOR);
  assertThat(payloadReader.parsedTableIds).isEqualTo(asList(107, 108));
}