MockMVC not working with camel in springboot
I had the same problem testing Apache Camel Rest endpoints.
I ended up using TestRestTemplate
@RunWith(SpringRunner.class)@SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)public class ComponentTest { private static String HEALTH_URL = "/api/api-prefix/health"; @Test public void testHealthCheck() { ResponseEntity<Map> health = testRestTemplate.getForEntity(HEALTH_URL, Map.class); assertEquals("health check failed", HttpStatus.OK, health.getStatusCode()); }}
I used an example from camel-example-test