### Question:
IbftExtraData implements ParsedExtraData { static IbftExtraData decodeRaw(final Bytes input) { checkArgument( input.size() > EXTRA_VANITY_LENGTH, "Invalid Bytes supplied - too short to produce a valid IBFT Extra Data object."); final Bytes vanityData = input.slice(0, EXTRA_VANITY_LENGTH); final Bytes rlpData = input.slice(EXTRA_VANITY_LENGTH); final RLPInput rlpInput = new BytesValueRLPInput(rlpData, false); rlpInput.enterList(); final Collection<Address> validators = rlpInput.readList(Address::readFrom); final Signature proposerSeal = parseProposerSeal(rlpInput); final Collection<Signature> seals = rlpInput.readList(rlp -> Signature.decode(rlp.readBytes())); rlpInput.leaveList(); return new IbftExtraData(vanityData, seals, proposerSeal, validators); } IbftExtraData(
      final Bytes vanityData,
      final Collection<Signature> seals,
      final Signature proposerSeal,
      final Collection<Address> validators); static IbftExtraData decode(final BlockHeader header); Bytes encode(); Bytes getVanityData(); Collection<Signature> getSeals(); Signature getProposerSeal(); Collection<Address> getValidators(); static final int EXTRA_VANITY_LENGTH; }### Answer:
@Test(expected = RLPException.class) public void incorrectlyStructuredRlpThrowsException() { final Signature proposerSeal = Signature.create(BigInteger.ONE, BigInteger.ONE, (byte) 0); final List<Address> validators = Lists.newArrayList(); final List<Signature> committerSeals = Lists.newArrayList(); final BytesValueRLPOutput encoder = new BytesValueRLPOutput(); encoder.startList(); encoder.writeList(validators, (validator, rlp) -> rlp.writeBytes(validator)); encoder.writeBytes(proposerSeal.encodedBytes()); encoder.writeList(committerSeals, (committer, rlp) -> rlp.writeBytes(committer.encodedBytes())); encoder.writeLong(1); encoder.endList(); final Bytes bufferToInject = Bytes.wrap(Bytes.wrap(new byte[32]), encoder.encoded()); IbftExtraData.decodeRaw(bufferToInject); }
@Test(expected = RLPException.class) public void incorrectlySizedVanityDataThrowsException() { final List<Address> validators = Arrays.asList(Address.ECREC, Address.SHA256); final Signature proposerSeal = Signature.create(BigInteger.ONE, BigInteger.ONE, (byte) 0); final List<Signature> committerSeals = Arrays.asList( Signature.create(BigInteger.ONE, BigInteger.TEN, (byte) 0), Signature.create(BigInteger.TEN, BigInteger.ONE, (byte) 0)); final BytesValueRLPOutput encoder = new BytesValueRLPOutput(); encoder.startList(); encoder.writeList(validators, (validator, rlp) -> rlp.writeBytes(validator)); encoder.writeBytes(proposerSeal.encodedBytes()); encoder.writeList(committerSeals, (committer, rlp) -> rlp.writeBytes(committer.encodedBytes())); encoder.endList(); final Bytes bufferToInject = Bytes.wrap(Bytes.wrap(new byte[31]), encoder.encoded()); IbftExtraData.decodeRaw(bufferToInject); }