Skip to content

Commit

Permalink
#497 - multi schema create tests
Browse files Browse the repository at this point in the history
  • Loading branch information
grabdoc committed Apr 27, 2024
1 parent ce0b348 commit ebd24db
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

Expand All @@ -44,13 +45,27 @@ void create() throws Exception {
.header("Content-Profile", "sakila")
.content(objectMapper.writeValueAsString(CREATE_EMP_REQUEST))
)
//.andDo(print())
.andDo(print())
.andExpect(status().isCreated())
.andExpect(jsonPath("$.row", equalTo(1)))
//.andExpect(jsonPath("$.keys.GENERATED_KEY").exists())
//.andExpect(jsonPath("$.keys.GENERATED_KEY", equalTo(5)))
.andExpect(jsonPath("$.keys.GENERATED_KEY").exists())
.andExpect(jsonPath("$.keys.GENERATED_KEY", equalTo(3)))
.andDo(document("mysql-create-emp-sakila"));


mockMvc.perform(post("/employee")
.contentType(APPLICATION_JSON)
.accept(APPLICATION_JSON)
.header("Content-Profile", "wakila")
.content(objectMapper.writeValueAsString(CREATE_EMP_REQUEST))
)
.andDo(print())
.andExpect(status().isCreated())
.andExpect(jsonPath("$.row", equalTo(1)))
.andExpect(jsonPath("$.keys.GENERATED_KEY").exists())
.andExpect(jsonPath("$.keys.GENERATED_KEY", equalTo(4)))
.andDo(document("mysql-create-emp-wakila"));

}


Expand Down
1 change: 0 additions & 1 deletion src/test/resources/testdata/CREATE_EMP_REQUEST.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"emp_id" : "3",
"first_name" : "Johny" ,
"last_name" : "Liver"

Expand Down

0 comments on commit ebd24db

Please sign in to comment.