Skip to content

[✨feat] CompanyName 구현 #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: feat/#50
Choose a base branch
from
Open

[✨feat] CompanyName 구현 #53

wants to merge 3 commits into from

Conversation

jsoonworld
Copy link
Member

📄 Work Description

  • 기업명을 값 객체로 다루기 위한 CompanyName VO를 구현했습니다.
  • 내부에 문자열 필드 value를 가지고 있으며, 생성 시 유효성 검증을 수행합니다.
  • 정적 팩터리 메서드 from()을 통해 생성하도록 제한하였습니다.
  • VO 특성에 맞게 equals, hashCode, toString을 오버라이드했습니다.

💭 Thoughts

  • 단순 문자열로 기업명을 다루기보다 VO로 분리하여 도메인 의미를 명확히 드러내고,
    유효성 검증 책임을 한 곳에 집중하도록 설계했습니다.
  • 현재는 두 가지 규칙(공백 불가, 64자 제한)을 검증하고 있으며,
    각 검증을 init 블록에서 직접 호출하여 의도를 더 잘 드러내는 방식으로 구성했습니다.
  • 예외는 InternshipException을 통해 처리하고, InternshipErrorCode 항목을 별도로 정의해
    도메인 일관성API 응답 처리의 명확성을 함께 고려했습니다.

✅ Testing Result

스크린샷 2025-05-18 오후 7 47 15

🗂 Related Issue

기업명을 값 객체로 다루기 위한 CompanyName 클래스를 구현했습니다.
- from() 정적 팩터리 메서드 제공
- 비어 있거나 64자를 초과하는 값에 대한 유효성 검증 포함
- VO 특성을 위한 equals, hashCode, toString 오버라이딩
- CompanyName VO의 유효성 검증을 위한 에러 코드 2종 추가
  - INVALID_COMPANY_NAME_EMPTY : 기업명이 비어 있을 경우
  - INVALID_COMPANY_NAME_TOO_LONG : 기업명이 64자를 초과할 경우
- 유효한 값 입력 시 CompanyName 정상 생성 여부 검증
- 공백 입력 시 INVALID_COMPANY_NAME_EMPTY 예외 발생 테스트
- 64자 초과 입력 시 INVALID_COMPANY_NAME_TOO_LONG 예외 발생 테스트
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces the CompanyName value object to encapsulate company name data with built-in validation rules. Key changes include:

  • Implementation of the CompanyName VO with private constructor and validation.
  • Addition of static factory method CompanyName.from().
  • Updates to the InternshipErrorCode enum to include company name error codes.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/test/kotlin/com/terning/server/kotlin/domain/internshipAnnouncement/CompanyNameTest.kt Added tests to validate correct creation and exception handling for CompanyName.
src/main/kotlin/com/terning/server/kotlin/domain/internshipAnnouncement/InternshipErrorCode.kt Added error codes specific to company name validation.
src/main/kotlin/com/terning/server/kotlin/domain/internshipAnnouncement/CompanyName.kt Implemented the CompanyName value object with validation and proper overrides.
Comments suppressed due to low confidence (1)

src/main/kotlin/com/terning/server/kotlin/domain/internshipAnnouncement/CompanyName.kt:29

  • Consider adding tests for equals, hashCode, and toString methods to ensure the value object behaves correctly in all scenarios.
override fun equals(other: Any?): Boolean = this === other || (other is CompanyName && value == other.value)

Copy link
Member

@leeeyubin leeeyubin left a comment

Choose a reason for hiding this comment

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

CompanyName 확인했습니다! 수고하셨어요!

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

Successfully merging this pull request may close these issues.

2 participants