Skip to content

[fix] 포스트 제목 최대 길이 변경에 따른 유효성 검증 테스트 수정#100

Merged
k3vin7 merged 1 commit intomainfrom
fix/post-validation
Mar 6, 2026
Merged

[fix] 포스트 제목 최대 길이 변경에 따른 유효성 검증 테스트 수정#100
k3vin7 merged 1 commit intomainfrom
fix/post-validation

Conversation

@k3vin7
Copy link
Contributor

@k3vin7 k3vin7 commented Mar 6, 2026

Summary

  • PostValidationTest의 제목 검증 테스트를 15자 → 40자 기준으로 수정
  • repeat(16)repeat(41), 경계값 성공 테스트도 repeat(15)repeat(40)

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the post title validation tests to accommodate the increased maximum length of post titles. The changes ensure that the tests accurately reflect the new validation rules for both creating and updating posts.

Highlights

  • Test Validation Update: The validation test for post titles has been updated to reflect the change in the maximum title length from 15 to 40 characters.
  • Boundary Condition Adjustment: The test cases now use 41 characters to test the failure condition for titles exceeding the maximum length and 40 characters for the successful boundary condition.
  • DTO Validation: Both PostCreateDto and PostUpdateDto validation tests have been modified to align with the new title length constraint.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • PostValidationTest.java
    • Updated validation tests to reflect the change in the maximum title length from 15 to 40 characters.
Activity
  • k3vin7 updated the validation tests for post titles.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

이 PR은 포스트 제목의 최대 길이가 15자에서 40자로 변경됨에 따라 관련 유효성 검증 테스트를 수정한 것으로 보입니다. 변경 사항은 올바르게 반영되었습니다. 다만, 테스트 코드 전반에 걸쳐 40, 41과 같은 매직 넘버가 사용되고 있어 유지보수성 측면에서 개선의 여지가 있습니다. 각 테스트에서 사용된 매직 넘버를 상수로 대체하여 코드의 가독성을 높이고 향후 변경에 더 유연하게 대응할 수 있도록 하는 것이 좋습니다. 자세한 내용은 개별 코멘트를 참고해주세요.

void title_Size_초과_실패() {
// given
String longTitle = "a".repeat(16);
String longTitle = "a".repeat(41);

Choose a reason for hiding this comment

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

medium

41과 같은 매직 넘버는 코드의 가독성과 유지보수성을 저해할 수 있습니다. 클래스 수준에 private static final int TITLE_MAX_LENGTH = 40;와 같은 상수를 선언하고, 여기서는 TITLE_MAX_LENGTH + 1을 사용하는 것이 좋습니다. 이렇게 하면 제목 최대 길이가 변경될 때 상수의 값만 수정하면 되므로 유지보수가 용이해집니다. 이 파일의 PostUpdateDtoValidationTest 내의 유사한 테스트(163행)에도 동일하게 적용하는 것을 고려해주세요.

// then
assertThat(violations).hasSize(1);
assertThat(violations.iterator().next().getMessage()).isEqualTo("제목은 15자를 초과할 수 없습니다");
assertThat(violations.iterator().next().getMessage()).isEqualTo("제목은 40자를 초과할 수 없습니다");

Choose a reason for hiding this comment

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

medium

에러 메시지 문자열에 하드코딩된 40이 있습니다. 앞서 제안한 TITLE_MAX_LENGTH 상수를 사용하면, "제목은 " + TITLE_MAX_LENGTH + "자를 초과할 수 없습니다"와 같이 에러 메시지를 동적으로 생성하여 일관성을 유지하고 향후 변경에 더 쉽게 대응할 수 있습니다. 이 파일의 PostUpdateDtoValidationTest 내의 유사한 테스트(179행)에도 동일하게 적용할 수 있습니다.

void title_40자_정확히_성공() {
// given
String exactTitle = "a".repeat(15); // 정확히 15자
String exactTitle = "a".repeat(40); // 정확히 40자

Choose a reason for hiding this comment

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

medium

경계값 테스트에서도 40이라는 매직 넘버 대신 TITLE_MAX_LENGTH와 같은 상수를 사용하는 것이 좋습니다. 이렇게 하면 이 숫자가 제목의 최대 길이를 의미한다는 것이 명확해지고, 코드의 가독성과 유지보수성이 향상됩니다.

@k3vin7 k3vin7 merged commit 0651c41 into main Mar 6, 2026
1 check passed
@k3vin7 k3vin7 deleted the fix/post-validation branch March 6, 2026 17:45
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.

1 participant