public static Deserializer<NeighborAdvertisement> deserializer() {
        return (data, offset, length) -> {
            checkInput(data, offset, length, HEADER_LENGTH);

            NeighborAdvertisement neighborAdvertisement = new NeighborAdvertisement();

            ByteBuffer bb = ByteBuffer.wrap(data, offset, length);

            int iscratch;

            iscratch = bb.getInt();
            neighborAdvertisement.routerFlag = (byte) (iscratch >> 31 & 0x1);
            neighborAdvertisement.solicitedFlag = (byte) (iscratch >> 30 & 0x1);
            neighborAdvertisement.overrideFlag = (byte) (iscratch >> 29 & 0x1);
            bb.get(neighborAdvertisement.targetAddress, 0, Ip6Address.BYTE_LENGTH);

            if (bb.limit() - bb.position() > 0) {
                NeighborDiscoveryOptions options = NeighborDiscoveryOptions.deserializer()
                        .deserialize(data, bb.position(), bb.limit() - bb.position());

                for (NeighborDiscoveryOptions.Option option : options.options()) {
                    neighborAdvertisement.addOption(option.type(), option.data());
                }
            }

            return neighborAdvertisement;
        };
    }
@Test
    public void testDeserializeTruncated() throws Exception {
        // Run the truncation test only on the NeighborAdvertisement header
        byte[] naHeader = new byte[NeighborAdvertisement.HEADER_LENGTH];
        ByteBuffer.wrap(bytePacket).get(naHeader);

        PacketTestUtils.testDeserializeTruncated(NeighborAdvertisement.deserializer(), naHeader);
    }