### Question:
DisconnectMessage extends AbstractMessageData { public static DisconnectMessage readFrom(final MessageData message) { if (message instanceof DisconnectMessage) { return (DisconnectMessage) message; } final int code = message.getCode(); if (code != WireMessageCodes.DISCONNECT) { throw new IllegalArgumentException( String.format("Message has code %d and thus is not a DisconnectMessage.", code)); } return new DisconnectMessage(message.getData()); } private  DisconnectMessage(final Bytes data); static DisconnectMessage create(final DisconnectReason reason); static DisconnectMessage readFrom(final MessageData message); @Override int getCode(); DisconnectReason getReason(); @Override String toString();  }### Answer:
@Test public void readFromWithWrongMessageType() { MessageData messageData = new RawMessage(WireMessageCodes.PING, Bytes.fromHexString("0xC103")); assertThatThrownBy(() -> DisconnectMessage.readFrom(messageData)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("Message has code 2 and thus is not a DisconnectMessage"); }