@Test public void serializeTest() { YieldMessage yieldMessage = new YieldMessage(111, null, null); assertThat(yieldMessage.getCode()).isEqualTo(70); assertThat(yieldMessage.getRequestId()).isEqualTo(111); assertThat(yieldMessage.getArguments()).isNull(); assertThat(yieldMessage.getArgumentsKw()).isNull(); String json = serializeToJson(yieldMessage); assertThat(json).isEqualTo("[70,111,{}]"); yieldMessage = new YieldMessage(111, Arrays.asList("Hello world"), null); assertThat(yieldMessage.getCode()).isEqualTo(70); assertThat(yieldMessage.getRequestId()).isEqualTo(111); assertThat(yieldMessage.getArguments()).containsExactly("Hello world"); assertThat(yieldMessage.getArgumentsKw()).isNull(); json = serializeToJson(yieldMessage); assertThat(json).isEqualTo("[70,111,{},[\"Hello world\"]]"); Map<String, Object> argumentsKw = new HashMap<>(); argumentsKw.put("firstname", "John"); argumentsKw.put("surname", "Doe"); yieldMessage = new YieldMessage(111, Arrays.asList("johnny"), argumentsKw); assertThat(yieldMessage.getCode()).isEqualTo(70); assertThat(yieldMessage.getRequestId()).isEqualTo(111); assertThat(yieldMessage.getArguments()).containsExactly("johnny"); assertThat(yieldMessage.getArgumentsKw()).containsExactly( MapEntry.entry("firstname", "John"), MapEntry.entry("surname", "Doe")); json = serializeToJson(yieldMessage); assertThat(json).isEqualTo( "[70,111,{},[\"johnny\"],{\"firstname\":\"John\",\"surname\":\"Doe\"}]"); argumentsKw = new HashMap<>(); argumentsKw.put("firstname", "John"); argumentsKw.put("surname", "Doe"); yieldMessage = new YieldMessage(111, null, argumentsKw); assertThat(yieldMessage.getCode()).isEqualTo(70); assertThat(yieldMessage.getRequestId()).isEqualTo(111); assertThat(yieldMessage.getArguments()).isNull(); assertThat(yieldMessage.getArgumentsKw()).containsExactly( MapEntry.entry("firstname", "John"), MapEntry.entry("surname", "Doe")); json = serializeToJson(yieldMessage); assertThat(json) .isEqualTo("[70,111,{},[],{\"firstname\":\"John\",\"surname\":\"Doe\"}]"); }
@Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); generator.writeStartObject(); generator.writeEndObject(); if (this.argumentsKw != null) { if (this.arguments == null) { generator.writeStartArray(); generator.writeEndArray(); } else { generator.writeObject(this.arguments); } generator.writeObject(this.argumentsKw); } else if (this.arguments != null) { generator.writeObject(this.arguments); } }
YieldMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); generator.writeStartObject(); generator.writeEndObject(); if (this.argumentsKw != null) { if (this.arguments == null) { generator.writeStartArray(); generator.writeEndArray(); } else { generator.writeObject(this.arguments); } generator.writeObject(this.argumentsKw); } else if (this.arguments != null) { generator.writeObject(this.arguments); } } }
YieldMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); generator.writeStartObject(); generator.writeEndObject(); if (this.argumentsKw != null) { if (this.arguments == null) { generator.writeStartArray(); generator.writeEndArray(); } else { generator.writeObject(this.arguments); } generator.writeObject(this.argumentsKw); } else if (this.arguments != null) { generator.writeObject(this.arguments); } } YieldMessage(long requestId, @Nullable List<Object> arguments,
			@Nullable Map<String, Object> argumentsKw); }
YieldMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); generator.writeStartObject(); generator.writeEndObject(); if (this.argumentsKw != null) { if (this.arguments == null) { generator.writeStartArray(); generator.writeEndArray(); } else { generator.writeObject(this.arguments); } generator.writeObject(this.argumentsKw); } else if (this.arguments != null) { generator.writeObject(this.arguments); } } YieldMessage(long requestId, @Nullable List<Object> arguments,
			@Nullable Map<String, Object> argumentsKw); static YieldMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getRequestId(); @Nullable List<Object> getArguments(); @Nullable Map<String, Object> getArgumentsKw(); @Override String toString(); }
YieldMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); generator.writeStartObject(); generator.writeEndObject(); if (this.argumentsKw != null) { if (this.arguments == null) { generator.writeStartArray(); generator.writeEndArray(); } else { generator.writeObject(this.arguments); } generator.writeObject(this.argumentsKw); } else if (this.arguments != null) { generator.writeObject(this.arguments); } } YieldMessage(long requestId, @Nullable List<Object> arguments,
			@Nullable Map<String, Object> argumentsKw); static YieldMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getRequestId(); @Nullable List<Object> getArguments(); @Nullable Map<String, Object> getArgumentsKw(); @Override String toString();  }