DefaultJsonMetadata extends JsonMetadata { @Override public JsonObject asJsonObject() { return metadata; } private  DefaultJsonMetadata(final JsonObject metadata); static MetadataBuilder metadataBuilder(); static MetadataBuilder metadataBuilderFrom(final Metadata metadata); static MetadataBuilder metadataBuilderFrom(final JsonObject jsonObject); @Override UUID id(); @Override String name(); @Override Optional<String> clientCorrelationId(); @Override List<UUID> causation(); @Override Optional<String> userId(); @Override Optional<String> sessionId(); @Override Optional<UUID> streamId(); @Override Optional<Long> version(); @Override Optional<Long> position(); @Override JsonObject asJsonObject(); @Override Optional<ZonedDateTime> createdAt(); @Override Optional<String> source(); @Override Optional<Long> eventNumber(); @Override Optional<Long> previousEventNumber(); @Override @SuppressWarnings({"squid:MethodCyclomaticComplexity", "squid:S1067", "squid:S00122"}) boolean equals(final Object o); @Override int hashCode();  }
@Test public void shouldReturnJsonObject() throws Exception { final JsonObject jsonObject = metadata.asJsonObject(); with(jsonObject.toString()) .assertEquals(ID, UUID_ID) .assertEquals(NAME, MESSAGE_NAME) .assertEquals(SOURCE, SOURCE_NAME) .assertEquals(CORRELATION + "." + CLIENT_ID, UUID_CLIENT_CORRELATION) .assertEquals(CAUSATION + "[0]", UUID_CAUSATION) .assertEquals(CONTEXT + "." + USER_ID, UUID_USER_ID) .assertEquals(CONTEXT + "." + SESSION_ID, UUID_SESSION_ID) .assertEquals(STREAM + "." + STREAM_ID, UUID_STREAM_ID) .assertEquals(STREAM + "." + VERSION, 99) .assertEquals(EVENT + "." + EVENT_NUMBER, 10) .assertEquals(EVENT + "." + PREVIOUS_EVENT_NUMBER, 9); }