### Question:
UnregisteredMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); if (this.registrationId != null || this.reason != null) { generator.writeStartObject(); if (this.reason != null) { generator.writeStringField("reason", this.reason); } if (this.registrationId != null) { generator.writeNumberField("registration", this.registrationId); } generator.writeEndObject(); } } UnregisteredMessage(long requestId);  UnregisteredMessage(long requestId, @Nullable Long registrationId,
			@Nullable String reason);  UnregisteredMessage(UnregisterMessage unregisterMessage); static UnregisteredMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getRequestId(); @Nullable Long getRegistrationId(); @Nullable String getReason(); @Override String toString();  }### Answer:
@Test public void serializeTest() { UnregisteredMessage unregisteredMessage = new UnregisteredMessage(13); assertThat(unregisteredMessage.getCode()).isEqualTo(67); assertThat(unregisteredMessage.getRequestId()).isEqualTo(13); assertThat(unregisteredMessage.getRegistrationId()).isNull(); assertThat(unregisteredMessage.getReason()).isNull(); String json = serializeToJson(unregisteredMessage); assertThat(json).isEqualTo("[67,13]"); unregisteredMessage = new UnregisteredMessage(13, 333L, "a reason"); assertThat(unregisteredMessage.getCode()).isEqualTo(67); assertThat(unregisteredMessage.getRequestId()).isEqualTo(13); assertThat(unregisteredMessage.getRegistrationId()).isEqualTo(333); assertThat(unregisteredMessage.getReason()).isEqualTo("a reason"); json = serializeToJson(unregisteredMessage); assertThat(json) .isEqualTo("[67,13,{\"reason\":\"a reason\",\"registration\":333}]"); }