Skip to content

test: 검색 기능 단위 테스트 추가#307

Merged
lovelyAlien merged 1 commit into
issue#304/feat/search-routefrom
issue#306/test/search
Dec 15, 2025
Merged

test: 검색 기능 단위 테스트 추가#307
lovelyAlien merged 1 commit into
issue#304/feat/search-routefrom
issue#306/test/search

Conversation

@lovelyAlien
Copy link
Copy Markdown
Collaborator

@lovelyAlien lovelyAlien commented Dec 15, 2025

작업 내용

RouteServiceTest (15개):

  • 루트 검색 기능 (키워드, 북마크, 사용자별)
  • 장소 목록 및 사진 목록 매핑 검증
  • 최대 10개 이미지 제한 검증
  • 활성 루트 조회
  • 북마크 기능
  • 엣지 케이스 (빈 결과, null 처리)

SearchFacadeTest (11개):

  • 장소/루트 검색 통합 기능
  • 카카오 API 통합 (일정 생성 페이지)
  • 검색 히스토리 저장
  • 최근 검색어 조회
  • 다양한 검색 시나리오 (내부 DB, 외부 API)

관련 이슈

Closes #308

RouteServiceTest (15개):
- 루트 검색 기능 (키워드, 북마크, 사용자별)
- 장소 목록 및 사진 목록 매핑 검증
- 최대 10개 이미지 제한 검증
- 활성 루트 조회
- 북마크 기능
- 엣지 케이스 (빈 결과, null 처리)

SearchFacadeTest (11개):
- 장소/루트 검색 통합 기능
- 카카오 API 통합 (일정 생성 페이지)
- 검색 히스토리 저장
- 최근 검색어 조회
- 다양한 검색 시나리오 (내부 DB, 외부 API)
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @lovelyAlien, 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!

이 PR은 RouteService와 SearchFacade의 핵심 검색 기능에 대한 광범위한 단위 테스트를 도입하여 애플리케이션의 검색 로직 견고성과 신뢰성을 크게 향상시키는 것을 목표로 합니다. 다양한 검색 시나리오와 엣지 케이스를 커버하여 기능의 정확성을 보장합니다.

Highlights

  • RouteService 단위 테스트 추가: 루트 검색 기능 (키워드, 북마크, 사용자별), 장소 목록 및 사진 목록 매핑 검증, 최대 10개 이미지 제한 검증, 활성 루트 조회, 북마크 기능, 엣지 케이스 (빈 결과, null 처리) 등 RouteService의 다양한 기능에 대한 포괄적인 단위 테스트가 추가되었습니다.
  • SearchFacade 단위 테스트 추가: 장소/루트 검색 통합 기능, 카카오 API 통합 (일정 생성 페이지), 검색 히스토리 저장, 최근 검색어 조회, 다양한 검색 시나리오 (내부 DB, 외부 API) 등 SearchFacade의 통합 검색 로직에 대한 단위 테스트가 추가되었습니다.
  • PhotoRepository 임포트 추가: PhotoRepository 인터페이스에 @Param 어노테이션 사용을 위한 org.springframework.data.repository.query.Param 임포트가 추가되었습니다.
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.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@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은 검색 기능에 대한 단위 테스트를 추가하는 중요한 작업입니다. RouteServiceSearchFacade에 대한 테스트 케이스를 꼼꼼하게 작성해주셔서 기능의 안정성을 크게 높였습니다. 다양한 시나리오와 엣지 케이스를 커버하는 테스트들이 인상적입니다.

리뷰에서는 주로 테스트 코드의 가독성과 유지보수성을 향상시키기 위한 몇 가지 스타일 개선 사항을 제안했습니다. FQN(Fully Qualified Name) 대신 import를 사용하고, 테스트 데이터 생성을 동적으로 처리하는 방식을 제안드렸습니다.

전반적으로 훌륭한 기여이며, 제안된 내용을 반영하면 코드가 더욱 견고해질 것입니다. 수고하셨습니다!

private RoutePlaceRepository routePlaceRepository;

@Mock
private com.server.domain.photo.repository.PhotoRepository photoRepository;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

안녕하세요. 코드 가독성을 위해 PhotoRepository를 FQN(Fully Qualified Name)으로 사용하는 대신 import하여 사용하는 것을 제안합니다. import com.server.domain.photo.repository.PhotoRepository;를 추가하고 여기서는 PhotoRepository만 사용하면 코드가 더 깔끔해집니다.

Suggested change
private com.server.domain.photo.repository.PhotoRepository photoRepository;
private PhotoRepository photoRepository;

Comment on lines +71 to +72
org.springframework.test.util.ReflectionTestUtils.setField(user, "id", 1L);
org.springframework.test.util.ReflectionTestUtils.setField(user, "nickname", "테스트 유저");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

안녕하세요. ReflectionTestUtils를 FQN으로 사용하고 계십니다. import org.springframework.test.util.ReflectionTestUtils;를 추가하고 클래스 이름을 직접 사용하면 코드가 더 간결해지고 가독성이 좋아집니다.

Suggested change
org.springframework.test.util.ReflectionTestUtils.setField(user, "id", 1L);
org.springframework.test.util.ReflectionTestUtils.setField(user, "nickname", "테스트 유저");
ReflectionTestUtils.setField(user, "id", 1L);
org.springframework.test.util.ReflectionTestUtils.setField(user, "nickname", "테스트 유저");

Comment on lines +363 to +365
when(photoRepository.findRepresentativePhotosByPlaceIds(
List.of(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L), PhotoType.PUBLIC))
.thenReturn(mockPhotos);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

안녕하세요. searchRoutesByKeyword_MaximumTenPhotos 테스트에서 장소 ID 목록이 하드코딩되어 있습니다. 테스트의 유연성과 유지보수성을 높이기 위해, 이 목록을 동적으로 생성하는 것을 고려해볼 수 있습니다. 예를 들어, LongStream을 사용하면 장소 개수가 변경되더라도 코드를 수정할 필요가 없습니다.

Suggested change
when(photoRepository.findRepresentativePhotosByPlaceIds(
List.of(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L), PhotoType.PUBLIC))
.thenReturn(mockPhotos);
when(photoRepository.findRepresentativePhotosByPlaceIds(
java.util.stream.LongStream.rangeClosed(1, 12).boxed().collect(java.util.stream.Collectors.toList()), PhotoType.PUBLIC))
.thenReturn(mockPhotos);

Comment on lines +64 to +65
org.springframework.test.util.ReflectionTestUtils.setField(user, "id", 1L);
org.springframework.test.util.ReflectionTestUtils.setField(user, "nickname", "테스트 유저");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

안녕하세요. ReflectionTestUtils를 FQN으로 사용하고 계십니다. import org.springframework.test.util.ReflectionTestUtils;를 추가하고 클래스 이름을 직접 사용하면 코드가 더 간결해지고 가독성이 좋아집니다.

Suggested change
org.springframework.test.util.ReflectionTestUtils.setField(user, "id", 1L);
org.springframework.test.util.ReflectionTestUtils.setField(user, "nickname", "테스트 유저");
ReflectionTestUtils.setField(user, "id", 1L);
org.springframework.test.util.ReflectionTestUtils.setField(user, "nickname", "테스트 유저");

@lovelyAlien lovelyAlien merged commit d790be7 into issue#304/feat/search-route Dec 15, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant