Skip to content

Commit

Permalink
test: Servlet 테스트 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
HubCreator committed Sep 13, 2023
1 parent 642bb8d commit 1277818
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions study/src/main/java/servlet/com/example/KoreanServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public void init(final ServletConfig config) throws ServletException {
@Override
protected void service(final HttpServletRequest request, final HttpServletResponse response) throws IOException {
getServletContext().log("service() 호출");
response.setCharacterEncoding("utf-8");
response.getWriter().write(인코딩);
}

Expand Down
4 changes: 2 additions & 2 deletions study/src/test/java/servlet/com/example/ServletTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void testSharedCounter() {

// expected를 0이 아닌 올바른 값으로 바꿔보자.
// 예상한 결과가 나왔는가? 왜 이런 결과가 나왔을까?
assertThat(Integer.parseInt(response.body())).isEqualTo(0);
assertThat(Integer.parseInt(response.body())).isEqualTo(3);
}

@Test
Expand All @@ -50,6 +50,6 @@ void testLocalCounter() {

// expected를 0이 아닌 올바른 값으로 바꿔보자.
// 예상한 결과가 나왔는가? 왜 이런 결과가 나왔을까?
assertThat(Integer.parseInt(response.body())).isEqualTo(0);
assertThat(Integer.parseInt(response.body())).isEqualTo(1);
}
}

0 comments on commit 1277818

Please sign in to comment.