package com.example;

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.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[]
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment=WebEnvironment.NONE)
public class WiremockForDocsMockServerApplicationTests {

	@Autowired
	private RestTemplate restTemplate;

	@Autowired
	private Service service;

	@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");
		// We're asserting if WireMock responded properly
		assertThat(this.service.go()).isEqualTo("Hello World");
		server.verify();
	}
}
//end::wiremock_test[]

@@ -11,24 +11,83 @@
 m.example;%0A%0A
+import static org.assertj.core.api.Assertions.assertThat;%0A%0A
 import org.j
@@ -389,28 +389,33 @@
 WireMock
-Expectations
+RestServiceServer
 ;%0Aimport
@@ -651,67 +651,8 @@
 e;%0A%0A
-import static org.assertj.core.api.Assertions.assertThat;%0A%0A
 @Dir
@@ -665,16 +665,17 @@
 ntext%0A//
+ 
 tag::wir
@@ -746,17 +746,19 @@
 ironment
-=
+ = 
 WebEnvir
@@ -1075,20 +1075,25 @@
 Mock
-Expectations
+RestServiceServer
 .wit
@@ -1151,20 +1151,14 @@
 rg%22)
-%0A%09%09%09%09.expect
+.stubs
 (%22re
@@ -1303,16 +1303,17 @@
 %0A%09%7D%0A%7D%0A//
+ 
 end::wir

Fix test that missed a re-factor