Rectangle 27 0

unit testing Junit Test to test Http Outbound endpoint in Mule Flow?

You can create a test flow with an HTTP Inbound Endpoint and a test:component for setting the payload, and add the flow file to your test configuration files. However, I prefer to use the Confluex Mock HTTP API to test applications with HTTP Outbound Endpoints. It sets up a mock HTTP server at localhost, where you can respond to different calls with specified data and response codes, so you can run all kinds of failure scenarios as well. Set up the mock server in a @Before annotated method in your FunctionalTestCase class and stop it in the @After method, so it will be available for the test methods.