BAEL-5234 - Apache Camel Routes Testing in Spring Boot (#11925)

* BAEL-4706 - Spring Boot with Spring Batch

* BAEL-3948 - Fix test(s) in spring-batch which leaves repository.sqlite
changed

* BAEL-4736 - Convert JSONArray to List of Object using camel-jackson

* BAEL-4756 - Mockito MockSettings

* BAEL-4756 - Mockito MockSettings - fix spelling

* BAEL-2674 - Upgrade the Okhttp article

* BAEL-4204 - Adding Interceptors in OkHTTP

* BAEL-4836 - Mocking Static Methods with Mockito

* BAEL-4205 - A Guide to Events in OkHTTP

* BAEL-5408 - Update Camel version in spring-boot-camel module

* BAEL-5234 - Apache Camel Routes Testing in Spring Boot

* BAEL-5234 - Apache Camel Routes Testing in Spring Boot

Co-authored-by: Jonathan Cook <jcook@sciops.esa.int>
This commit is contained in:
Jonathan Cook
2022-03-14 23:35:32 +01:00
committed by GitHub
parent f74056e1d7
commit 7681cb2d65
5 changed files with 74 additions and 0 deletions
@@ -0,0 +1,32 @@
package com.baeldung.camel.boot.testing;
import org.apache.camel.EndpointInject;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
import org.apache.camel.test.spring.junit5.MockEndpoints;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
@CamelSpringBootTest
@MockEndpoints("file:output")
class GreetingsFileRouterUnitTest {
@Autowired
private ProducerTemplate template;
@EndpointInject("mock:file:output")
private MockEndpoint mock;
@Test
void whenSendBody_thenGreetingReceivedSuccessfully() throws InterruptedException {
mock.expectedBodiesReceived("Hello Baeldung Readers!");
template.sendBody("direct:start", null);
mock.assertIsSatisfied();
}
}