Skip to content

Commit

Permalink
chore: "application/json;charset=UTF-8" 상수 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
BGuga committed Sep 27, 2023
1 parent a88c769 commit 123e933
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
@WebMvcTest(controllers = CurriculumController.class)
public class CurriculumDocumentation extends NewDocumentation {

private static final String UTF8_JSON_TYPE = "application/json;charset=UTF-8";

@MockBean
CurriculumService curriculumService;

Expand All @@ -29,7 +31,7 @@ public class CurriculumDocumentation extends NewDocumentation {
given(curriculumService.create(any())).willReturn(1L);

given
.contentType("application/json;charset=UTF-8")
.contentType(UTF8_JSON_TYPE)
.body(CURRICULUM_REQUEST)
.when().post("/curriculums")
.then().log().all().apply(document("curriculums/create"))
Expand All @@ -41,7 +43,7 @@ public class CurriculumDocumentation extends NewDocumentation {
given(curriculumService.findCurriculums()).willReturn(CURRICULUMS_RESPONSE);

given
.contentType("application/json;charset=UTF-8")
.contentType(UTF8_JSON_TYPE)
.body(CURRICULUM_REQUEST)
.when().get("/curriculums")
.then().log().all().apply(document("curriculums/find"))
Expand All @@ -53,7 +55,7 @@ public class CurriculumDocumentation extends NewDocumentation {
doNothing().when(curriculumService).update(any(), any());

given
.contentType("application/json;charset=UTF-8")
.contentType(UTF8_JSON_TYPE)
.body(CURRICULUM_EDIT_REQUEST)
.when().put("/curriculums/{curriculumId}", 1)
.then().log().all().apply(document("curriculums/update"))
Expand All @@ -65,7 +67,7 @@ public class CurriculumDocumentation extends NewDocumentation {
doNothing().when(curriculumService).delete(any());

given
.contentType("application/json;charset=UTF-8")
.contentType(UTF8_JSON_TYPE)
.when().delete("/curriculums/{curriculumId}", 1)
.then().log().all().apply(document("curriculums/delete"))
.statusCode(HttpStatus.NO_CONTENT.value());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
@WebMvcTest(EssayAnswerController.class)
public class EssayAnswerDocumentaion extends NewDocumentation {

private static final String UTF8_JSON_TYPE = "application/json;charset=UTF-8";

@MockBean
EssayAnswerService essayAnswerService;

Expand All @@ -51,7 +53,7 @@ public class EssayAnswerDocumentaion extends NewDocumentation {
EssayAnswerRequest request = new EssayAnswerRequest(1L, "answer");

given
.contentType("application/json;charset=UTF-8")
.contentType(UTF8_JSON_TYPE)
.body(request)
.when().post("essay-answers")
.then().log().all().apply(document("essay-answer/create"))
Expand All @@ -70,7 +72,7 @@ public class EssayAnswerDocumentaion extends NewDocumentation {
Collections.emptyList());

given
.contentType("application/json;charset=UTF-8")
.contentType(UTF8_JSON_TYPE)
.body(request)
.when().get("essay-answers")
.then().log().all().apply(document("essay-answer/search/list"))
Expand All @@ -82,7 +84,7 @@ public class EssayAnswerDocumentaion extends NewDocumentation {
EssayAnswerUpdateRequest request = new EssayAnswerUpdateRequest("new Answer");

given
.contentType("application/json;charset=UTF-8")
.contentType(UTF8_JSON_TYPE)
.body(request)
.when().patch("essay-answers/{id}", 1)
.then().log().all().apply(document("essay-answer/update"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
@WebMvcTest(controllers = KeywordController.class)
public class KeywordDocumentation extends NewDocumentation {

private static final String UTF8_JSON_TYPE = "application/json;charset=UTF-8";

@MockBean
private KeywordService keywordService;

Expand All @@ -33,7 +35,7 @@ public class KeywordDocumentation extends NewDocumentation {
given(keywordService.createKeyword(any(), any())).willReturn(1L);

given
.contentType("application/json;charset=UTF-8")
.contentType(UTF8_JSON_TYPE)
.body(KEYWORD_CREATE_REQUEST)
.when().post("/sessions/1/keywords")
.then().log().all().apply(document("keywords/create"))
Expand All @@ -55,7 +57,7 @@ public class KeywordDocumentation extends NewDocumentation {
doNothing().when(keywordService).updateKeyword(any(), any(), any());

given
.contentType("application/json;charset=UTF-8")
.contentType(UTF8_JSON_TYPE)
.body(KEYWORD_UPDATE_REQUEST)
.when().put("/sessions/1/keywords/1")
.then().log().all().apply(document("keywords/update"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
@WebMvcTest(controllers = NewSessionController.class)
public class NewSessionDocumentation extends NewDocumentation {

private static final String UTF8_JSON_TYPE = "application/json;charset=UTF-8";

@MockBean
private NewSessionService sessionService;

Expand All @@ -28,7 +30,7 @@ public class NewSessionDocumentation extends NewDocumentation {
given(sessionService.createSession(any(), any())).willReturn(1L);

given
.contentType("application/json;charset=UTF-8")
.contentType(UTF8_JSON_TYPE)
.body(SESSION_CREATE_REQUEST)
.when().post("/curriculums/1/sessions")
.then().log().all().apply(document("sessions-new/create"))
Expand All @@ -50,7 +52,7 @@ public class NewSessionDocumentation extends NewDocumentation {
doNothing().when(sessionService).updateSession(any(), any());

given
.contentType("application/json;charset=UTF-8")
.contentType(UTF8_JSON_TYPE)
.body(SESSION_UPDATE_REQUEST)
.when().put("/curriculums/1/sessions/1")
.then().log().all().apply(document("sessions-new/update"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
@WebMvcTest(controllers = QuizController.class)
public class QuizDocumentation extends NewDocumentation {

private static final String UTF8_JSON_TYPE = "application/json;charset=UTF-8";

@MockBean
private QuizService quizService;

Expand All @@ -29,7 +31,7 @@ public class QuizDocumentation extends NewDocumentation {
given(quizService.createQuiz(any(), any())).willReturn(1L);

given
.contentType("application/json;charset=UTF-8")
.contentType(UTF8_JSON_TYPE)
.body(QUIZ_REQUEST)
.when().post("/sessions/{sessionId}/keywords/{keywordId}/quizs", 1L, 1L)
.then().log().all().apply(document("quiz/create"))
Expand Down Expand Up @@ -68,7 +70,7 @@ public class QuizDocumentation extends NewDocumentation {
doNothing().when(quizService).updateQuiz(any(), any());

given
.contentType("application/json;charset=UTF-8")
.contentType(UTF8_JSON_TYPE)
.body(QUIZ_EDIT_REQUEST)
.when().put("/sessions/{sessionId}/keywords/{keywordId}/quizs/{quizId}", 1L, 1L, 1L)
.then().log().all().apply(document("quiz/update"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
@WebMvcTest(controllers = RecommendedController.class)
public class RecommendDocument extends NewDocumentation {

private static final String UTF8_JSON_TYPE = "application/json;charset=UTF-8";

@MockBean
RecommendedPostService recommendedPostService;

Expand All @@ -23,7 +25,7 @@ public class RecommendDocument extends NewDocumentation {
RecommendedRequest recommendUrlValue = new RecommendedRequest("recommendUrlValue");

given
.contentType("application/json;charset=UTF-8")
.contentType(UTF8_JSON_TYPE)
.body(recommendUrlValue)
.when().post("/keywords/{keywordId}/recommended-posts", 1L)
.then().log().all().apply(document("recommend/create"))
Expand All @@ -35,7 +37,7 @@ public class RecommendDocument extends NewDocumentation {
RecommendedUpdateRequest recommendedUpdateRequest = new RecommendedUpdateRequest("recommendUrlValue");

given
.contentType("application/json;charset=UTF-8")
.contentType(UTF8_JSON_TYPE)
.body(recommendedUpdateRequest)
.when().put("/keywords/{keywordId}/recommended-posts/{recommendedId}", 1L, 2L)
.then().log().all().apply(document("recommend/update"))
Expand Down

0 comments on commit 123e933

Please sign in to comment.