ismailbaskin opened a new issue #2067: URL: https://github.com/apache/camel-quarkus/issues/2067
I want to write a unit test for `sms` method by mocking ProducerTemplate. ```java @Path("/") public class SmsResource { @Inject ProducerTemplate producerTemplate; @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/sms") public Message sms() { return producerTemplate .requestBody("twilio://message/creator?from=RAW(+15005550006)&to=RAW(+15005550006)&body=TestMessage", null, Message.class); } } ``` I've tried that but it doesn't work. ```java @QuarkusTest class SmsControllerTest { @Inject SmsResource smsResource; @InjectMocks ProducerTemplate producerTemplate; @BeforeEach public void setup() throws Exception { MockitoAnnotations.openMocks(this); } @Test void sendSms() throws Exception { Message message = Message.fromJson("{\"body\":\"Test Message\",\"status\": \"queued\"}", new ObjectMapper()); when(producerTemplate.requestBody(anyString(), null, Message.class)).thenReturn(message); smsResource.sms(); } } ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org