### Question:
AbortMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeStartObject(); if (this.message != null) { generator.writeStringField("message", this.message); } generator.writeEndObject(); generator.writeString(this.reason); } AbortMessage(WampError reason, @Nullable String message);  AbortMessage(WampError reason); private  AbortMessage(String reason, @Nullable String message); static AbortMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); @Nullable String getMessage(); @Nullable String getReason(); @Override String toString();  }### Answer:
@Test public void serializeTest() { AbortMessage abortMessage = new AbortMessage(WampError.NO_SUCH_REGISTRATION, "No such registration"); assertThat(abortMessage.getCode()).isEqualTo(3); assertThat(abortMessage.getMessage()).isEqualTo("No such registration"); assertThat(abortMessage.getReason()).isEqualTo("wamp.error.no_such_registration"); String json = serializeToJson(abortMessage); assertThat(json).isEqualTo( "[3,{\"message\":\"No such registration\"},\"wamp.error.no_such_registration\"]"); abortMessage = new AbortMessage(WampError.NO_SUCH_REGISTRATION); assertThat(abortMessage.getCode()).isEqualTo(3); assertThat(abortMessage.getMessage()).isNull(); assertThat(abortMessage.getReason()).isEqualTo("wamp.error.no_such_registration"); json = serializeToJson(abortMessage); assertThat(json).isEqualTo("[3,{},\"wamp.error.no_such_registration\"]"); }