Skip to content

스프린트 미션7 기본완료 심화 X#163

Open
geoni-98 wants to merge 1 commit into
codeit-bootcamp-spring:최건위from
geoni-98:최건위-sprint7

Hidden character warning

The head ref may contain hidden characters: "\ucd5c\uac74\uc704-sprint7"
Open

스프린트 미션7 기본완료 심화 X#163
geoni-98 wants to merge 1 commit into
codeit-bootcamp-spring:최건위from
geoni-98:최건위-sprint7

Conversation

@geoni-98
Copy link
Copy Markdown
Collaborator

@geoni-98 geoni-98 commented Apr 5, 2026

요구사항

기본

  • 기본 항목 1
  • 기본 항목 2

심화

  • 심화 항목 1
  • 심화 항목 2

주요 변경사항

스크린샷

image

멘토에게

  • 셀프 코드 리뷰를 통해 질문 이어가겠습니다.

@geoni-98 geoni-98 requested a review from eedys1234 April 5, 2026 14:56
password: ${PROD_DB_PASSWORD} # 운영 비밀번호는 안전하게 환경변수로 주입
jpa:
hibernate:
ddl-auto: validate # 운영 데이터 보호를 위해 validate 사용
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍👍👍👍

@@ -0,0 +1,22 @@
server:
port: 80 # [체크리스트] 운영용 서버 포트 (보통 80 또는 443 사용)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘 알려진 프로토콜들은 포트번호가 지정되어 사용하지 않습니다.
e.g. http: 80, https: 443

인프라를 구성할 때 ALB에서 80, 443 으로 오는 Port를 WAS가 구동되는 8080으로 포트 포워딩 처리합니다.

port를 8080으로 변경해주시면 좋을 것 같아요.

import org.springframework.test.web.servlet.MockMvc;
import org.springframework.transaction.annotation.Transactional;

@SpringBootTest
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

중복되는 여러 애노테이션을 커스텀 애노테이션으로 선언하면 의미를 표현할 수 있고 재사용할 수 있는 장점이 있습니다.

e.g. @IntegrationTEST

@Test
@DisplayName("공개 채널 생성 - 통합 성공")
void createPublicChannel_Success() throws Exception {
PublicChannelCreateRequest request = new PublicChannelCreateRequest("백엔드 잡담방", "백엔드 개발자 모여라");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

통합테스트를 진행하실 때 특정 기능을 테스트 하기 위해 주어져야 하는 기본 데이터(픽스쳐)가 존재하는데요.

2가지 방법을 통해 기본 데이터(픽스쳐)를 생성할 수 있습니다.

  1. 별도 메타데이터를 저장하는 Schema.sql를 미리 준비하여 테스트 코드가 실행되는 시점에 수행
  2. 메타데이터를 생성하는 API를 호출

2번의 경우를 예를 들자면 비밀 채널을 수정하기 위해 비밀 채널을 생성하는 API 호출을 given 영역, 비밀 채널명을 수정하는 API 호출을 when 영역으로 선언하시면 됩니다.


given(userService.findAll()).willReturn(List.of(mockUser));

// When & Then
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍👍

@RequiredArgsConstructor
public enum ErrorCode {

INVALID_INPUT(400, "COM_001", "입력값이 올바르지 않습니다."),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

중간에 Code값 주신 부분 좋습니다.
다만 3자리수는 적은 것 같아 4자리수 추천드립니다.

import com.sprint.mission.discodeit.exception.DiscodeitException;
import com.sprint.mission.discodeit.exception.ErrorCode;

public abstract class BinaryContentException extends DiscodeitException {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

중간 Exception을 가진다면 다음과 같은 장점이 있습니다.
Exception을 전역적으로 처리하는 곳에서 중간 Exception 종류에 대한 세밀한 핸들링이 가능합니다. 👍👍👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants