use of uk.gov.justice.services.messaging.Envelope in project microservice_framework by CJSCommonPlatform.
the class DispatcherDelegateTest method requestMethodShouldDelegateToDispatcher.
@Test
public void requestMethodShouldDelegateToDispatcher() throws Exception {
final JsonEnvelope envelope = mock(JsonEnvelope.class);
when(envelopePayloadTypeConverter.convert(any(Envelope.class), eq(JsonValue.class))).thenReturn(envelope);
when(jsonEnvelopeRepacker.repack(envelope)).thenReturn(envelope);
dispatcherDelegate.request(envelope);
verify(dispatcher).dispatch(envelope);
}
use of uk.gov.justice.services.messaging.Envelope in project microservice_framework by CJSCommonPlatform.
the class DispatcherDelegateTest method requestMethodShouldSpecifyResponsePayloadType.
@Test
public void requestMethodShouldSpecifyResponsePayloadType() throws Exception {
final JsonEnvelope envelope = mock(JsonEnvelope.class);
final JsonEnvelope response = mock(JsonEnvelope.class);
when(envelopePayloadTypeConverter.convert(any(Envelope.class), eq(JsonValue.class))).thenReturn(envelope);
when(jsonEnvelopeRepacker.repack(envelope)).thenReturn(envelope);
when(dispatcher.dispatch(envelope)).thenReturn(response);
dispatcherDelegate.request(envelope, Object.class);
verify(requestResponseEnvelopeValidator).validateResponse(response);
}
use of uk.gov.justice.services.messaging.Envelope in project microservice_framework by CJSCommonPlatform.
the class DispatcherDelegateTest method requestMethodShouldValidateEnvelope.
@Test
public void requestMethodShouldValidateEnvelope() throws Exception {
final JsonEnvelope envelope = mock(JsonEnvelope.class);
final JsonEnvelope response = mock(JsonEnvelope.class);
when(envelopePayloadTypeConverter.convert(any(Envelope.class), eq(JsonValue.class))).thenReturn(envelope);
when(jsonEnvelopeRepacker.repack(envelope)).thenReturn(envelope);
when(dispatcher.dispatch(envelope)).thenReturn(response);
dispatcherDelegate.request(envelope);
verify(requestResponseEnvelopeValidator).validateResponse(response);
}
use of uk.gov.justice.services.messaging.Envelope in project microservice_framework by CJSCommonPlatform.
the class DispatcherDelegateTest method sendMethodShouldValidateEnvelope.
@Test
public void sendMethodShouldValidateEnvelope() throws Exception {
final JsonEnvelope envelope = mock(JsonEnvelope.class);
when(envelopePayloadTypeConverter.convert(any(Envelope.class), eq(JsonValue.class))).thenReturn(envelope);
when(jsonEnvelopeRepacker.repack(envelope)).thenReturn(envelope);
dispatcherDelegate.send(envelope);
verify(requestResponseEnvelopeValidator).validateRequest(envelope);
}
use of uk.gov.justice.services.messaging.Envelope in project microservice_framework by CJSCommonPlatform.
the class DispatcherDelegateTest method sendMethodShouldDelegateToDispatcher.
@Test
public void sendMethodShouldDelegateToDispatcher() throws Exception {
final JsonEnvelope envelope = mock(JsonEnvelope.class);
when(envelopePayloadTypeConverter.convert(any(Envelope.class), eq(JsonValue.class))).thenReturn(envelope);
when(jsonEnvelopeRepacker.repack(envelope)).thenReturn(envelope);
dispatcherDelegate.send(envelope);
verify(dispatcher).dispatch(envelope);
}
Aggregations