ShardedMessageEnvelope implements Jsonifiable<JsonObject>, WithDittoHeaders<ShardedMessageEnvelope>, WithId { public static ShardedMessageEnvelope fromJson(final JsonObject jsonObject) { final String extractedId = jsonObject.getValueOrThrow(JSON_ID); final EntityId entityId = DefaultEntityId.of(extractedId); final String extractedType = jsonObject.getValueOrThrow(JSON_TYPE); final JsonObject extractedMessage = jsonObject.getValueOrThrow(JSON_MESSAGE); final JsonObject jsonDittoHeaders = jsonObject.getValueOrThrow(JSON_DITTO_HEADERS); final DittoHeaders extractedDittoHeaders = DittoHeaders.newBuilder(jsonDittoHeaders).build(); return of(entityId, extractedType, extractedMessage, extractedDittoHeaders); } private  ShardedMessageEnvelope(final EntityId id,
            final String type,
            final JsonObject message,
            final DittoHeaders dittoHeaders); static ShardedMessageEnvelope of(final EntityId id,
            final String type,
            final JsonObject message,
            final DittoHeaders dittoHeaders); static ShardedMessageEnvelope fromJson(final JsonObject jsonObject); EntityId getEntityId(); String getType(); JsonObject getMessage(); @Override DittoHeaders getDittoHeaders(); @Override ShardedMessageEnvelope setDittoHeaders(final DittoHeaders dittoHeaders); @Override JsonObject toJson(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); static final JsonFieldDefinition<String> JSON_ID; static final JsonFieldDefinition<String> JSON_TYPE; static final JsonFieldDefinition<JsonObject> JSON_MESSAGE; static final JsonFieldDefinition<JsonObject> JSON_DITTO_HEADERS; }
@Test public void deserializeMessage() { final ShardedMessageEnvelope actual = ShardedMessageEnvelope.fromJson(SHARDED_MESSAGE_ENVELOPE_JSON); assertThat(actual).isEqualTo(SHARDED_MESSAGE_ENVELOPE); }