@@ -0,0 +1,2398 @@
+import io.specto.hoverfly.junit.HoverflyRule;%0Aimport org.junit.Before;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.springframework.http.RequestEntity;%0Aimport org.springframework.http.ResponseEntity;%0Aimport org.springframework.web.client.RestTemplate;%0A%0Aimport java.net.URI;%0Aimport java.net.URISyntaxException;%0A%0Aimport static net.javacrumbs.jsonunit.fluent.JsonFluentAssert.assertThatJson;%0Aimport static org.assertj.core.api.Assertions.assertThat;%0Aimport static org.springframework.http.HttpStatus.CREATED;%0Aimport static org.springframework.http.HttpStatus.OK;%0Aimport static org.springframework.http.MediaType.APPLICATION_JSON;%0A%0Apublic class URLHoverflyRuleTest %7B%0A%0A    @Rule%0A    public HoverflyRule hoverflyRule = HoverflyRule.buildFromUrl(%22http://raw.githubusercontent.com/SpectoLabs/hoverfly-junit/d0d41dfdcb250c6bb02ada63d304b4afddf5f2e4/src/test/resources/test-service.json%22).build();%0A%0A    private RestTemplate restTemplate;%0A%0A    @Before%0A    public void setUp() %7B%0A        restTemplate = new RestTemplate();%0A    %7D%0A%0A    @Test%0A    public void shouldBeAbleToMakeABookingUsingHoverfly() throws URISyntaxException %7B%0A        // Given%0A        final RequestEntity%3CString%3E bookFlightRequest = RequestEntity.post(new URI(%22http://www.my-test.com/api/bookings%22))%0A                .contentType(APPLICATION_JSON)%0A                .body(%22%7B%5C%22flightId%5C%22: %5C%221%5C%22%7D%22);%0A%0A        // When%0A        final ResponseEntity%3CString%3E bookFlightResponse = restTemplate.exchange(bookFlightRequest, String.class);%0A%0A        // Then%0A        assertThat(bookFlightResponse.getStatusCode()).isEqualTo(CREATED);%0A        assertThat(bookFlightResponse.getHeaders().getLocation()).isEqualTo(new URI(%22http://localhost/api/bookings/1%22));%0A    %7D%0A%0A    @Test%0A    public void shouldBeAbleToGetABookingUsingHoverfly() %7B%0A        // When%0A        final ResponseEntity%3CString%3E getBookingResponse = restTemplate.getForEntity(%22http://www.my-test.com/api/bookings/1%22, String.class);%0A%0A        // Then%0A        assertThat(getBookingResponse.getStatusCode()).isEqualTo(OK);%0A        assertThatJson(getBookingResponse.getBody()).isEqualTo(%22%7B%22 +%0A                %22%5C%22bookingId%5C%22:%5C%221%5C%22,%22 +%0A                %22%5C%22origin%5C%22:%5C%22London%5C%22,%22 +%0A                %22%5C%22destination%5C%22:%5C%22Singapore%5C%22,%22 +%0A                %22%5C%22time%5C%22:%5C%222011-09-01T12:30%5C%22,%22 +%0A                %22%5C%22_links%5C%22:%7B%5C%22self%5C%22:%7B%5C%22href%5C%22:%5C%22http://localhost/api/bookings/1%5C%22%7D%7D%22 +%0A                %22%7D%22);%0A    %7D%0A%0A%7D%0A

Test for rule where a URL is configured as the source json