### Question:
NewBlockMessage extends AbstractMessageData { public static NewBlockMessage readFrom(final MessageData message) { if (message instanceof NewBlockMessage) { return (NewBlockMessage) message; } final int code = message.getCode(); if (code != NewBlockMessage.MESSAGE_CODE) { throw new IllegalArgumentException( String.format("Message has code %d and thus is not a NewBlockMessage.", code)); } return new NewBlockMessage(message.getData()); } private  NewBlockMessage(final Bytes data); @Override int getCode(); static NewBlockMessage create(final Block block, final Difficulty totalDifficulty); static NewBlockMessage readFrom(final MessageData message); Block block(final ProtocolSchedule protocolSchedule); Difficulty totalDifficulty(final ProtocolSchedule protocolSchedule);  }### Answer:
@Test public void readFromMessageWithWrongCodeThrows() { final RawMessage rawMsg = new RawMessage(EthPV62.BLOCK_HEADERS, Bytes.of(0)); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> NewBlockMessage.readFrom(rawMsg)); }