use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldNotMatchAsJson.
@Test(expected = AssertionError.class)
public void shouldNotMatchAsJson() throws Exception {
final Metadata metadata = defaultMetadataWithName(EVENT_NAME).build();
assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().isJson(allOf(withJsonPath("$.id", equalTo(ID.toString())), withJsonPath("$.name", equalTo("does not match")))));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldMatchMetadataByStreamId.
@Test
public void shouldMatchMetadataByStreamId() throws Exception {
final Metadata metadata = metadataWithRandomUUID(EVENT_NAME).withStreamId(STREAM_ID).build();
assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().withStreamId(STREAM_ID));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldMatchWithNoSettings.
@Test
public void shouldMatchWithNoSettings() throws Exception {
final Metadata metadata = metadataWithRandomUUID(EVENT_NAME).build();
assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata());
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldFailIfSessionIdDoesNotMatch.
@Test(expected = AssertionError.class)
public void shouldFailIfSessionIdDoesNotMatch() throws Exception {
final Metadata metadata = metadataWithRandomUUID(EVENT_NAME).withSessionId(SESSION_ID).build();
assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().withSessionId("does not match"));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldMatchAGivenMetadataWhereIdBecomesCausationAndDoesNotMatchName.
@Test
public void shouldMatchAGivenMetadataWhereIdBecomesCausationAndDoesNotMatchName() throws Exception {
final Metadata testMetadata = defaultMetadataRandomIdWithName(EVENT_NAME).withCausation(ID, CAUSATION_ID).build();
final Metadata expectedMetadata = defaultMetadataWithName(COMMAND_ACTION).build();
assertThat(testMetadata, JsonEnvelopeMetadataMatcher.metadata().envelopedWith(expectedMetadata));
}
Aggregations