### Question:
BytesSSZReader implements SSZReader { @Override public int readInt(int bitLength) { checkArgument(bitLength % 8 == 0, "bitLength must be a multiple of 8"); int byteLength = bitLength / 8; ensureBytes(byteLength, () -> "SSZ encoded data has insufficient length to read a " + bitLength + "-bit integer"); Bytes bytes = content.slice(index, byteLength); int zeroBytes = bytes.numberOfTrailingZeroBytes(); if ((byteLength - zeroBytes) > 4) { throw new InvalidSSZTypeException("decoded integer is too large for an int"); } index += byteLength; return bytes.slice(0, bytes.size() - zeroBytes).toInt(LITTLE_ENDIAN); } BytesSSZReader(Bytes content); @Override Bytes readBytes(int limit); @Override int readInt(int bitLength); @Override long readLong(int bitLength); @Override BigInteger readBigInteger(int bitLength); @Override BigInteger readUnsignedBigInteger(int bitLength); @Override UInt256 readUInt256(); @Override UInt384 readUInt384(); @Override Bytes readAddress(); @Override Bytes readHash(int hashLength); @Override List<Bytes> readBytesList(int limit); @Override List<String> readStringList(int limit); @Override List<Integer> readIntList(int bitLength); @Override List<Long> readLongIntList(int bitLength); @Override List<BigInteger> readBigIntegerList(int bitLength); @Override List<BigInteger> readUnsignedBigIntegerList(int bitLength); @Override List<UInt256> readUInt256List(); @Override List<UInt384> readUInt384List(); @Override List<Bytes> readAddressList(); @Override List<Bytes> readHashList(int hashLength); @Override List<Boolean> readBooleanList(); @Override boolean isComplete();  }### Answer:
@Test void shouldThrowWhenReadingOversizedInt() { InvalidSSZTypeException ex = assertThrows(InvalidSSZTypeException.class, () -> { SSZ.decode(fromHexString("1122334455667788"), r -> r.readInt(64)); }); assertEquals("decoded integer is too large for an int", ex.getMessage()); }
@Test void shouldThrowWhenInputExhausted() { EndOfSSZException ex = assertThrows(EndOfSSZException.class, () -> SSZ.decode(Bytes.EMPTY, reader -> reader.readInt(16))); assertEquals("End of SSZ source reached", ex.getMessage()); }