use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class DefaultJsonMetadataBuilderTest method shouldBuildMetadataWithUserId.
@Test
public void shouldBuildMetadataWithUserId() {
final String userId = "a51597dc-2526-4c71-bd08-5031c79f11e3";
final Metadata metadata = metadataWithDefaults().withUserId(userId).build();
assertThat(metadata.userId().get(), is(userId));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class DefaultJsonMetadataBuilderTest method shouldBuildMetadataWithStreamId.
@Test
public void shouldBuildMetadataWithStreamId() {
final UUID streamId = randomUUID();
final Metadata metadata = metadataWithDefaults().withStreamId(streamId).build();
assertThat(metadata.streamId().get(), is(streamId));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeBuilderTest method shouldBuildJsonEnvelopeFromMetadataAndJsonValue.
@Test
public void shouldBuildJsonEnvelopeFromMetadataAndJsonValue() throws Exception {
final Metadata metadata = mock(Metadata.class);
final JsonValue payload = mock(JsonValue.class);
final JsonEnvelope envelope = JsonEnvelopeBuilder.envelopeFrom(metadata, payload);
assertThat(envelope.metadata(), is(metadata));
assertThat(envelope.payload(), is(payload));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldMatchAGivenMetadataWhereEnvelopedFromJsonEnvelope.
@Test
public void shouldMatchAGivenMetadataWhereEnvelopedFromJsonEnvelope() throws Exception {
final Metadata testMetadata = defaultMetadataRandomIdWithName(EVENT_NAME).withCausation(ID, CAUSATION_ID).build();
final JsonEnvelope jsonEnvelope = envelope().with(defaultMetadataWithName(COMMAND_ACTION)).withPayloadOf("Test", "value").build();
assertThat(testMetadata, JsonEnvelopeMetadataMatcher.withMetadataEnvelopedFrom(jsonEnvelope));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldFailIfStreamIdDoesNotMatch.
@Test(expected = AssertionError.class)
public void shouldFailIfStreamIdDoesNotMatch() throws Exception {
final Metadata metadata = metadataWithRandomUUID(EVENT_NAME).withStreamId(randomUUID()).build();
assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().withStreamId(randomUUID()));
}
Aggregations