Search in sources :

Example 1 with TraceLogger

use of uk.gov.justice.services.messaging.logging.TraceLogger in project microservice_framework by CJSCommonPlatform.

the class MessagingClientGenerator_MethodBodyTest method shouldSendEnvelopeToDestination.

@Test
public void shouldSendEnvelopeToDestination() throws Exception {
    generator.run(messagingRamlWithDefaults().with(resource().withRelativeUri("/cakeshop.controller.command").withDefaultPostAction()).build(), configurationWithBasePackage(BASE_PACKAGE, outputFolder, generatorProperties().withServiceComponentOf("COMMAND_CONTROLLER")));
    final Class<?> generatedClass = compiler.compiledClassOf(BASE_PACKAGE, "RemoteCommandController2EventProcessorMessageContextCakeshopControllerCommand");
    final Object instance = instanceOf(generatedClass);
    setField(instance, "traceLogger", mock(TraceLogger.class));
    final JsonEnvelope envelope = mock(JsonEnvelope.class);
    final Method method = firstMethodOf(generatedClass).get();
    method.invoke(instance, envelope);
    verify(sender).send(envelope, "cakeshop.controller.command");
}
Also used : TraceLogger(uk.gov.justice.services.messaging.logging.TraceLogger) JsonEnvelope(uk.gov.justice.services.messaging.JsonEnvelope) Method(java.lang.reflect.Method) Test(org.junit.Test)

Aggregations

Method (java.lang.reflect.Method)1 Test (org.junit.Test)1 JsonEnvelope (uk.gov.justice.services.messaging.JsonEnvelope)1 TraceLogger (uk.gov.justice.services.messaging.logging.TraceLogger)1