use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class MetadataBuilderFactoryTest method shouldProvideMetadataBuilderWithUuidAndName.
@Test
public void shouldProvideMetadataBuilderWithUuidAndName() throws Exception {
final UUID id = UUID.randomUUID();
final String name = "name";
final Metadata metadata = MetadataBuilderFactory.metadataOf(id, name).build();
assertThat(metadata.id(), is(id));
assertThat(metadata.name(), is(name));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class MetadataBuilderFactoryTest method shouldProvideMetadataBuilderWithUuidAsStringAndName.
@Test
public void shouldProvideMetadataBuilderWithUuidAsStringAndName() throws Exception {
final UUID id = UUID.randomUUID();
final String name = "name";
final Metadata metadata = MetadataBuilderFactory.metadataOf(id.toString(), name).build();
assertThat(metadata.id(), is(id));
assertThat(metadata.name(), is(name));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class MetadataBuilderFactoryTest method shouldProvideMetadataBuilderWithRandomUuidAndDummyName.
@Test
public void shouldProvideMetadataBuilderWithRandomUuidAndDummyName() throws Exception {
final Metadata metadata = MetadataBuilderFactory.metadataWithRandomUUIDAndName().build();
assertThat(metadata.id(), notNullValue());
assertThat(metadata.name(), is("dummy"));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class MetadataBuilderFactoryTest method shouldProvideMetadataBuilderFromMetadata.
@Test
public void shouldProvideMetadataBuilderFromMetadata() throws Exception {
final UUID id = UUID.randomUUID();
final String name = "name";
final Metadata originalMetadata = JsonEnvelope.metadataBuilder().withId(id).withName(name).build();
final Metadata metadata = MetadataBuilderFactory.metadataFrom(originalMetadata).build();
assertThat(metadata.id(), notNullValue());
assertThat(metadata.name(), is(name));
}
use of uk.gov.justice.services.messaging.Metadata in project microservice_framework by CJSCommonPlatform.
the class EventFilterInterceptorCodeGeneratorTest method nowTestTheGeneratedClass.
private void nowTestTheGeneratedClass(final Class<?> generatedClass) throws Exception {
final String eventName = "an.event.name";
final Interceptor interceptor = buildTheClassForTest(generatedClass, new MyCustomEventFilter(eventName));
final InterceptorContext interceptorContext_1 = mock(InterceptorContext.class, "interceptorContext_1");
final InterceptorContext interceptorContext_2 = mock(InterceptorContext.class, "interceptorContext_2");
final InterceptorChain interceptorChain = mock(InterceptorChain.class);
final JsonEnvelope jsonEnvelope = mock(JsonEnvelope.class);
final Metadata metadata = mock(Metadata.class);
when(interceptorContext_1.inputEnvelope()).thenReturn(jsonEnvelope);
when(jsonEnvelope.metadata()).thenReturn(metadata);
when(metadata.name()).thenReturn(eventName);
when(interceptorChain.processNext(interceptorContext_1)).thenReturn(interceptorContext_2);
assertThat(interceptor.process(interceptorContext_1, interceptorChain), is(interceptorContext_2));
}
Aggregations