Skip to content

Test: 통합 테스트 기반 정비 및 서비스 테스트 커버리지 확장#143

Merged
SinnoLn merged 45 commits intomainfrom
test
May 19, 2025
Merged

Test: 통합 테스트 기반 정비 및 서비스 테스트 커버리지 확장#143
SinnoLn merged 45 commits intomainfrom
test

Conversation

@SinnoLn
Copy link
Contributor

@SinnoLn SinnoLn commented May 19, 2025

주요 변경 사항

  • FileUseCaseTest 제거: 기존 FileService 기반의 레거시 테스트 제거
  • AbstractIntegrationTest 기반의 통합 테스트 구조 확립
  • BasePostServiceTest 작성 및 파일 삭제 로직 등 주요 기능 커버리지 추가
  • 테스트 실행 시 캐시 영향 제거를 위한 clean 명령 추가
  • application-test.yml 도입 및 Testcontainers 연동 구성
  • BoardUseCaseTestBoardServiceTest로 파일 리네이밍 및 구조 정리
  • ValidationUtil을 통한 게시글 생성/수정 입력 검증 추가
  • @FastTest, @SlowTest 애노테이션에 메서드 단위 적용 가능하도록 개선
  • Jenkins 환경에서 Testcontainers 비활성화 처리

목적

  • 테스트 커버리지를 높이고 유지보수성을 향상시키기 위함
  • 실제 운영 환경과 격리된 테스트 환경 구축을 통해 안정적인 테스트 수행 보장
  • 테스트 속도 및 명확한 책임 분리를 위해 테스트 유형별 애노테이션 적용

SinnoLn added 30 commits May 13, 2025 01:16
- 알림 ID, 읽음 여부, 메시지, 이벤트 타입, 대상 ID/타입, 생성 시간 포함
- 프론트엔드 알림 UI 제공을 위한 구조 설계
- NotificationMapper.toResponse 정적 메서드로 변환 처리
- 메시지, 타입, 시간 등의 정보 포함
…ry 생성

- NotificationRepository: JPA 기반 알림 저장소 정의
- NotificationPersistencePort: 아웃포트 인터페이스 정의
- NotificationPersistenceAdapter: 알림 저장 기능 구현
…+ add markAllRead and getUnreadNotifications
- 테스트 시 AOT 관련 오류 방지를 위해 AOT 비활성화 설정 추가
  - processTestAot.enabled = false
  - jvmArgs 및 systemProperty를 통한 spring.aot.enabled 설정

- Testcontainers 기반 통합 테스트 지원을 위해 의존성 추가
  - spring-boot-testcontainers
  - testcontainers, testcontainers:mysql, testcontainers:junit-jupiter
SinnoLn added 15 commits May 18, 2025 02:09
- 테스트용 DB(MySQL), Redis, Mail, JWT, 파일 경로 등 설정 추가
- AOT 환경 분리 및 Testcontainers 통합 테스트를 위한 환경 정의
- 관리자 테스트 계정 정보 포함 (admin: test-admin / admin1234)
- ValidationUtil 유틸 클래스 추가
  - requireNonBlank(String, String) 메서드로 필드 유효성 검사 수행
- BasePostService, JokboPostService, PicturePostService에 제목/내용 비어 있음 검증 로직 적용
- 게시글 요청 시 제목/내용이 null이거나 공백이면 BoardDomainException 발생
- createStudent(): ProfilePhoto를 고정 UUID로 생성하고, 기본 정보 명시적으로 설정
- createGraduatedStudent(): Graduation 엔티티를 포함하여 졸업생 생성 로직 분리
- Member 객체 생성 시 더 현실적인 테스트용 mock 데이터 반영
- 테스트 코드에서 재사용할 수 있는 fixture 유틸 정비
- BoardUseCaseTest 클래스를 BoardServiceTest로 명확히 리네이밍
- 위치를 clubArchive.application.service → common.application.service로 이동
- BoardService에 대한 단위 테스트로 용도 통일
- 공통 통합 테스트 설정을 위한 추상 클래스 생성
- @SpringBootTest, @testcontainers, @slowtest, @activeprofiles(test) 어노테이션 적용
- 테스트 컨테이너 기반의 MySQL 설정 및 DynamicPropertySource로 속성 주입
- 게시글 생성, 수정, 삭제, 조회, 좋아요/취소, 최신글 조회 등 주요 기능 테스트 추가
- 게시글 타입 및 권한 검증, 예외 발생 케이스 테스트 포함
- 좋아요 수 증가/감소 및 조회수 증가 검증을 위한 EntityManager flush/clear 처리 추가
- 통합 테스트 성능 및 안정성을 위한 @AbstractIntegrationTest 기반 설정 적용
- BoardUseCase, FileUseCase 등 mock 주입 및 공통 설정 정리
commit 3d5a2e2
Author: SinnoLn <sintmtn69@gmail.com>
Date:   Mon May 19 14:43:18 2025 +0900

    fix: Notification 엔티티의 targetType 열 EnumType.STRING으로 지정하여 스키마 검증 오류 해결

commit f2c7c96
Author: Lee Jiny <ok373737@naver.com>
Date:   Mon May 19 14:31:18 2025 +0900

    Feat/alarm events: 알람 API 생성 (#142)

    * feat(notification): 알림 도메인 및 EventType 정의

    * feat: 알림 응답용 DTO(NotificationResponse) 생성

    - 알림 ID, 읽음 여부, 메시지, 이벤트 타입, 대상 ID/타입, 생성 시간 포함
    - 프론트엔드 알림 UI 제공을 위한 구조 설계

    * feat: Notification → NotificationResponse 변환용 Mapper 추가

    - NotificationMapper.toResponse 정적 메서드로 변환 처리
    - 메시지, 타입, 시간 등의 정보 포함

    * refactor: mapper폴더 이동

    * refactor: postType -> targetType으로 이름 변경

    * feat(notification): 구현체 NotificationPersistenceAdapter 및 JPA Repository 생성

    - NotificationRepository: JPA 기반 알림 저장소 정의
    - NotificationPersistencePort: 아웃포트 인터페이스 정의
    - NotificationPersistenceAdapter: 알림 저장 기능 구현

    * feat(notification): NotificationService 및 UseCase 생성

    * feat(notification): NotificationMessageBuilder 헬퍼 클래스 구현

    * refactor: targetType nullable로, EventType 메세지 수정

    * feat(notification): 알림 서비스 계층 및 포트/어댑터 구조 구현

    * feat(notification): 알림 API 컨트롤러 및 Swagger 문서 어노테이션 추가

    * feat(board): 댓글/좋아요 작성 시 알림 생성 로직 연동

    * feat(suggestion): 건의 게시글 답변 시 사용자 알림 생성 추가

    * feat(notification): 알림 도메인 예외 처리 클래스 추가

    * feat: add @EnableScheduling to BackendApplication for enabling scheduled tasks

    * refactor: decouple notification creation logic for parent and child comments in CommentService

    * refactor: simplify sorting logic in MyPageController by removing redundant PageRequest override

    * refactor: remove redundant @GeneratedValue on UUID primary key in Notification entity

    * feat: add NotificationCleanupScheduler to delete read notifications older than 30 days

    * docs: extend NotificationApiDocument with unread and bulk read annotations

    * refactor: split NotificationPersistenceAdapter to remove unused MemberRepository injection

    * docs:add swagger config

    * feat: add UnreadCountResponse

    * refactor: modify return value (long, void) to int

    * chore(notification): create Flyway V5 migration for notification table

    * refactor(notification): move unread count to UnreadCountResponse DTO + add markAllRead and getUnreadNotifications

    * feat(notification): add unread notification query and batch read endpoints

    * merge --squash main

commit 2d34789
Author: SinnoLn <sintmtn69@gmail.com>
Date:   Mon May 19 14:19:52 2025 +0900

    fix: logging.Filter 제거 및 CORS에 PATCH 메서드 허용

commit 2973c33
Author: Lee Jiny <ok373737@naver.com>
Date:   Wed May 14 21:10:18 2025 +0900

    fix: spring-app timeZone Seoul로 변경 (#141)

    * fix: 시간대 Seoul로 변경

    * fix: 시간대 Seoul로 변경 (spring-app)

commit 839c6c8
Author: Lee Jiny <ok373737@naver.com>
Date:   Wed May 14 20:50:21 2025 +0900

    fix: 시간대 Seoul로 변경 (#140)

# Conflicts:
#	src/main/java/org/nova/backend/board/common/application/service/BasePostService.java
#	src/main/java/org/nova/backend/notification/domain/model/entity/Notification.java

# Conflicts:
#	src/main/java/org/nova/backend/board/common/application/service/BasePostService.java
#	src/main/java/org/nova/backend/notification/domain/model/entity/Notification.java
@SinnoLn SinnoLn merged commit f47cc9c into main May 19, 2025
4 checks passed
@SinnoLn SinnoLn deleted the test branch May 19, 2025 17:41
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