Polishing: replace spaces with tabs in doc examples

See gh-37
This commit is contained in:
Andy Wilkinson
2015-06-16 17:21:43 +01:00
parent 8307fb5428
commit 833f0eabb8
9 changed files with 29 additions and 29 deletions

View File

@@ -25,18 +25,18 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
public class AlwaysDo {
private MockMvc mockMvc;
private WebApplicationContext context;
// tag::always-do[]
@Before
public void setUp() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
.apply(documentationConfiguration())
.alwaysDo(document("{method-name}/{step}/"))
.build();
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
.apply(documentationConfiguration())
.alwaysDo(document("{method-name}/{step}/"))
.build();
}
// end::always-do[]
}

View File

@@ -25,12 +25,12 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
public class CustomEncoding {
@Autowired
private WebApplicationContext context;
private MockMvc mockMvc;
@Before
public void setUp() {
// tag::custom-encoding[]

View File

@@ -25,12 +25,12 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
public class CustomUriConfiguration {
@Autowired
private WebApplicationContext context;
private MockMvc mockMvc;
@Before
public void setUp() {
// tag::custom-uri-configuration[]

View File

@@ -25,13 +25,13 @@ import org.springframework.web.context.WebApplicationContext;
import static org.springframework.restdocs.RestDocumentation.documentationConfiguration;
public class ExampleApplicationTests {
// tag::mock-mvc-setup[]
@Autowired
private WebApplicationContext context;
private MockMvc mockMvc;
@Before
public void setUp() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)

View File

@@ -26,9 +26,9 @@ import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
public class Hypermedia {
private MockMvc mockMvc;
public void links() throws Exception {
// tag::links[]
this.mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON))
@@ -38,16 +38,16 @@ public class Hypermedia {
linkWithRel("bravo").description("Link to the bravo resource"))); // <3>
// end::links[]
}
public void explicitExtractor() throws Exception {
this.mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
//tag::explicit-extractor[]
.andDo(document("index").withLinks(halLinks(), // <1>
linkWithRel("alpha").description("Link to the alpha resource"),
linkWithRel("alpha").description("Link to the alpha resource"),
linkWithRel("bravo").description("Link to the bravo resource")));
// end::explicit-extractor[]
}
}

View File

@@ -26,7 +26,7 @@ import org.springframework.test.web.servlet.MockMvc;
public class InvokeService {
private MockMvc mockMvc;
public void invokeService() throws Exception {
// tag::invoke-service[]
this.mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON)) // <1>
@@ -34,5 +34,5 @@ public class InvokeService {
.andDo(document("index")); // <3>
// end::invoke-service[]
}
}

View File

@@ -26,9 +26,9 @@ import org.springframework.restdocs.payload.FieldType;
import org.springframework.test.web.servlet.MockMvc;
public class Payload {
private MockMvc mockMvc;
public void response() throws Exception {
// tag::response[]
this.mockMvc.perform(get("/user/5").accept(MediaType.APPLICATION_JSON))
@@ -38,7 +38,7 @@ private MockMvc mockMvc;
fieldWithPath("contact.email").description("The user's email address"))); // <3>
// end::response[]
}
public void explicitType() throws Exception {
this.mockMvc.perform(get("/user/5").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())

View File

@@ -26,7 +26,7 @@ import org.springframework.test.web.servlet.MockMvc;
public class QueryParameters {
private MockMvc mockMvc;
public void queryParameters() throws Exception {
// tag::query-parameters[]
this.mockMvc.perform(get("/users?page=2&per_page=100"))
@@ -37,5 +37,5 @@ public class QueryParameters {
));
// end::query-parameters[]
}
}

View File

@@ -25,7 +25,7 @@ import org.springframework.test.web.servlet.MockMvc;
public class ResponsePostProcessing {
private MockMvc mockMvc;
public void general() throws Exception {
// tag::general[]
this.mockMvc.perform(get("/"))
@@ -34,5 +34,5 @@ public class ResponsePostProcessing {
.andDocument("index")); // <2>
// end::general[]
}
}