use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldMatchAsJson.
@Test
public void shouldMatchAsJson() throws Exception {
final Metadata metadata = defaultMetadataWithName(EVENT_NAME).build();
assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().isJson(allOf(withJsonPath("$.id", equalTo(ID.toString())), withJsonPath("$.name", equalTo(EVENT_NAME)), withJsonPath("$.context.user", equalTo(USER_ID)))));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldMatchMetadataByName.
@Test
public void shouldMatchMetadataByName() throws Exception {
final Metadata metadata = metadataWithRandomUUID(EVENT_NAME).build();
assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().withName(EVENT_NAME));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldFailIfCausationIdDoesNotMatch.
@Test(expected = AssertionError.class)
public void shouldFailIfCausationIdDoesNotMatch() throws Exception {
final Metadata metadata = metadataWithRandomUUID(EVENT_NAME).withCausation(randomUUID()).build();
assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().withCausationIds(randomUUID()));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldFailIfClientCorrelationIdDoesNotMatch.
@Test(expected = AssertionError.class)
public void shouldFailIfClientCorrelationIdDoesNotMatch() throws Exception {
final Metadata metadata = metadataWithRandomUUID(EVENT_NAME).withClientCorrelationId(CLIENT_CORRELATION_ID).build();
assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().withClientCorrelationId("does not match"));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldMatchMetadataAll.
@Test
public void shouldMatchMetadataAll() throws Exception {
final Metadata metadata = defaultMetadataWithName(EVENT_NAME).build();
assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().withId(ID).withName(EVENT_NAME).withCausationIds(CAUSATION_ID).withUserId(USER_ID).withSessionId(SESSION_ID).withStreamId(STREAM_ID).withVersion(VERSION).withClientCorrelationId(CLIENT_CORRELATION_ID));
}
Aggregations