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");
}
Aggregations