Skip to content

Commit

Permalink
pg,mysql function/procedure tests refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
souravroy committed Feb 10, 2024
1 parent f111cc9 commit 7594f8c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

import java.util.Map;

import static org.hamcrest.Matchers.*;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.instanceOf;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
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 @@ -25,8 +27,10 @@ void execute() throws Exception {
""";

mockMvc.perform(post("/function/GetMovieRentalRateFunc")
.contentType(MediaType.APPLICATION_JSON).characterEncoding("utf-8")
.content(json).accept(MediaType.APPLICATION_JSON))
.characterEncoding(UTF_8)
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.content(json))
.andExpect(status().isOk())
.andExpect(jsonPath("$", instanceOf(Map.class)))
.andExpect(jsonPath("$.*", hasSize(1)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

import java.util.Map;

import static org.hamcrest.Matchers.*;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.instanceOf;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
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 @@ -26,8 +28,10 @@ void execute() throws Exception {
""";

mockMvc.perform(post("/procedure/GetMovieRentalRateProc")
.contentType(MediaType.APPLICATION_JSON).characterEncoding("utf-8")
.content(json).accept(MediaType.APPLICATION_JSON))
.characterEncoding(UTF_8)
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.content(json))
.andExpect(status().isOk())
.andExpect(jsonPath("$", instanceOf(Map.class)))
.andExpect(jsonPath("$.*", hasSize(2)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

import java.util.Map;

import static org.hamcrest.Matchers.*;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.instanceOf;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
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 @@ -26,8 +28,10 @@ void execute() throws Exception {
""";

mockMvc.perform(post("/function/GetMovieRentalRateFunc")
.contentType(MediaType.APPLICATION_JSON).characterEncoding("utf-8")
.content(json).accept(MediaType.APPLICATION_JSON))
.characterEncoding(UTF_8)
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.content(json))
.andExpect(status().isOk())
.andExpect(jsonPath("$", instanceOf(Map.class)))
.andExpect(jsonPath("$.*", hasSize(1)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

import java.util.Map;

import static org.hamcrest.Matchers.*;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.instanceOf;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
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 @@ -26,8 +28,10 @@ void execute() throws Exception {
""";

mockMvc.perform(post("/procedure/GetMovieRentalRateProc")
.contentType(MediaType.APPLICATION_JSON).characterEncoding("utf-8")
.content(json).accept(MediaType.APPLICATION_JSON))
.characterEncoding(UTF_8)
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.content(json))
.andExpect(status().isOk())
.andExpect(jsonPath("$", instanceOf(Map.class)))
.andExpect(jsonPath("$.*", hasSize(1)))
Expand Down

0 comments on commit 7594f8c

Please sign in to comment.