mirror of
https://github.com/robindhole/sfg-restdocs-example.git
synced 2025-03-16 12:50:09 +00:00
adding response example
This commit is contained in:
parent
cd16adf327
commit
520ca97e23
@ -24,6 +24,8 @@ import static org.mockito.ArgumentMatchers.any;
|
|||||||
import static org.mockito.BDDMockito.given;
|
import static org.mockito.BDDMockito.given;
|
||||||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
|
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
|
||||||
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*;
|
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*;
|
||||||
|
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
|
||||||
|
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
|
||||||
import static org.springframework.restdocs.request.RequestDocumentation.*;
|
import static org.springframework.restdocs.request.RequestDocumentation.*;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
|
|
||||||
@ -58,6 +60,17 @@ class BeerControllerTest {
|
|||||||
),
|
),
|
||||||
requestParameters(
|
requestParameters(
|
||||||
parameterWithName("iscold").description("Is Beer Cold Query param")
|
parameterWithName("iscold").description("Is Beer Cold Query param")
|
||||||
|
),
|
||||||
|
responseFields(
|
||||||
|
fieldWithPath("id").description("Id of Beer"),
|
||||||
|
fieldWithPath("version").description("Version number"),
|
||||||
|
fieldWithPath("createdDate").description("Date Created"),
|
||||||
|
fieldWithPath("lastModifiedDate").description("Date Updated"),
|
||||||
|
fieldWithPath("beerName").description("Beer Name"),
|
||||||
|
fieldWithPath("beerStyle").description("Beer Style"),
|
||||||
|
fieldWithPath("upc").description("UPC of Beer"),
|
||||||
|
fieldWithPath("price").description("Price"),
|
||||||
|
fieldWithPath("quantityOnHand").description("Quantity On hand")
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user