use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class DefaultJsonMetadataTest method shouldTestEqualsAndHashCode.
@SuppressWarnings({ "squid:MethodCyclomaticComplexity", "squid:S1067", "squid:S00122" })
@Test
public void shouldTestEqualsAndHashCode() {
final Metadata item1 = metadata(UUID_ID, UUID_CLIENT_CORRELATION, UUID_CAUSATION, UUID_USER_ID, UUID_SESSION_ID, UUID_STREAM_ID, MESSAGE_NAME, STREAM_VERSION);
final Metadata item2 = metadata(UUID_ID, UUID_CLIENT_CORRELATION, UUID_CAUSATION, UUID_USER_ID, UUID_SESSION_ID, UUID_STREAM_ID, MESSAGE_NAME, STREAM_VERSION);
final Metadata item3 = metadata(UUID.randomUUID().toString(), UUID_CLIENT_CORRELATION, UUID_CAUSATION, UUID_USER_ID, UUID_SESSION_ID, UUID_STREAM_ID, MESSAGE_NAME, STREAM_VERSION);
final Metadata item4 = metadata(UUID_ID, UUID.randomUUID().toString(), UUID_CAUSATION, UUID_USER_ID, UUID_SESSION_ID, UUID_STREAM_ID, MESSAGE_NAME, STREAM_VERSION);
final Metadata item5 = metadata(UUID_ID, UUID_CLIENT_CORRELATION, UUID.randomUUID().toString(), UUID_USER_ID, UUID_SESSION_ID, UUID_STREAM_ID, MESSAGE_NAME, STREAM_VERSION);
final Metadata item6 = metadata(UUID_ID, UUID_CLIENT_CORRELATION, UUID_CAUSATION, UUID.randomUUID().toString(), UUID_SESSION_ID, UUID_STREAM_ID, MESSAGE_NAME, STREAM_VERSION);
final Metadata item7 = metadata(UUID_ID, UUID_CLIENT_CORRELATION, UUID_CAUSATION, UUID_USER_ID, UUID.randomUUID().toString(), UUID_STREAM_ID, MESSAGE_NAME, STREAM_VERSION);
final Metadata item8 = metadata(UUID_ID, UUID_CLIENT_CORRELATION, UUID_CAUSATION, UUID_USER_ID, UUID_SESSION_ID, UUID.randomUUID().toString(), MESSAGE_NAME, STREAM_VERSION);
final Metadata item9 = metadata(UUID_ID, UUID_CLIENT_CORRELATION, UUID_CAUSATION, UUID_USER_ID, UUID_SESSION_ID, UUID_STREAM_ID, "dummy name", STREAM_VERSION);
final Metadata item10 = metadata(UUID_ID, UUID_CLIENT_CORRELATION, UUID_CAUSATION, UUID_USER_ID, UUID_SESSION_ID, UUID_STREAM_ID, MESSAGE_NAME, 0L);
new EqualsTester().addEqualityGroup(item1, item2).addEqualityGroup(item3).addEqualityGroup(item4).addEqualityGroup(item5).addEqualityGroup(item6).addEqualityGroup(item7).addEqualityGroup(item8).addEqualityGroup(item9).addEqualityGroup(item10).testEquals();
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldMatchMetadataBySessionId.
@Test
public void shouldMatchMetadataBySessionId() throws Exception {
final Metadata metadata = metadataWithRandomUUID(EVENT_NAME).withSessionId(SESSION_ID).build();
assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().withSessionId(SESSION_ID));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldFailIfNameDoesNotMatch.
@Test(expected = AssertionError.class)
public void shouldFailIfNameDoesNotMatch() throws Exception {
final Metadata metadata = metadataWithRandomUUID(EVENT_NAME).build();
assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().withName("event.not.match"));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldMatchAGivenMetadata.
@Test
public void shouldMatchAGivenMetadata() throws Exception {
final Metadata testMetadata = defaultMetadataWithName(EVENT_NAME).build();
final Metadata expectedMetadata = defaultMetadataWithName(EVENT_NAME).build();
assertThat(testMetadata, JsonEnvelopeMetadataMatcher.metadata().of(expectedMetadata));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class JsonEnvelopeMetadataMatcherTest method shouldFailIfUserIdDoesNotMatch.
@Test(expected = AssertionError.class)
public void shouldFailIfUserIdDoesNotMatch() throws Exception {
final Metadata metadata = metadataWithRandomUUID(EVENT_NAME).withUserId(USER_ID).build();
assertThat(metadata, JsonEnvelopeMetadataMatcher.metadata().withUserId("does not match"));
}
Aggregations