Fix test that missed a re-factor

This commit is contained in:
Dave Syer
2016-07-26 15:11:17 +01:00
parent 2706005ba9
commit c523a25baa

View File

@@ -1,22 +1,22 @@
package com.example;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.cloud.contract.wiremock.WireMockExpectations;
import org.springframework.cloud.contract.wiremock.WireMockRestServiceServer;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.RestTemplate;
import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
//tag::wiremock_test[]
// tag::wiremock_test[]
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment=WebEnvironment.NONE)
@SpringBootTest(webEnvironment = WebEnvironment.NONE)
public class WiremockForDocsMockServerApplicationTests {
@Autowired
@@ -28,12 +28,11 @@ public class WiremockForDocsMockServerApplicationTests {
@Test
public void contextLoads() throws Exception {
// will read stubs from default /resources/stubs location
MockRestServiceServer server = WireMockExpectations.with(this.restTemplate)
.baseUrl("http://example.org")
.expect("resource");
MockRestServiceServer server = WireMockRestServiceServer.with(this.restTemplate)
.baseUrl("http://example.org").stubs("resource");
// We're asserting if WireMock responded properly
assertThat(this.service.go()).isEqualTo("Hello World");
server.verify();
}
}
//end::wiremock_test[]
// end::wiremock_test[]