Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9c76b46
feat: TestContainers 초기 설정
1winhyun Dec 16, 2025
a2b6696
feat: Feed 관련 단위테스트를 위한 fixture 구현
1winhyun Dec 17, 2025
0c39523
feat: Feed 관련 단위테스트를 위한 fixture 추가 구현
1winhyun Dec 17, 2025
db08450
refactor: FeedTestFixture createFeed 접근제어자 변경
1winhyun Dec 22, 2025
e19b1f4
test: FeedUsecase 테스트 코드 작성
1winhyun Dec 22, 2025
ea89714
test: FeedRepository 테스트 코드 작성
1winhyun Dec 22, 2025
5bd6b9d
test: CommentRepository 테스트 코드 작성
1winhyun Dec 22, 2025
c934809
feat: LinkedUserTextFixture 구현
1winhyun Dec 22, 2025
0bb26fa
test: LinkedUserRepository 테스트 코드 작성
1winhyun Dec 22, 2025
05cc746
test: ReactionRepository 테스트 코드 작성
1winhyun Dec 22, 2025
4af544c
refactor: FeedRepositoryTest 데이터 설정 수정
1winhyun Dec 22, 2025
d0bb557
refactor: LinkedUserTestFixture로 클래스명 수정
1winhyun Dec 22, 2025
3522a39
test: CommentDeleteServiceTest 테스트 코드 작성
1winhyun Dec 26, 2025
5d483b2
test: CommentGetServiceTest 테스트 코드 작성
1winhyun Dec 26, 2025
be689b3
test: CommentSaveServiceTest 테스트 코드 작성
1winhyun Dec 26, 2025
7fbc671
test: FeedDeleteServiceTest 테스트 코드 작성
1winhyun Dec 26, 2025
cb025c5
test: FeedGetServiceTest 테스트 코드 작성
1winhyun Dec 26, 2025
59e63d6
test: FeedSaveServiceTest 테스트 코드 작성
1winhyun Dec 26, 2025
5422d99
test: FeedUpdateServiceTest 테스트 코드 작성
1winhyun Dec 26, 2025
8deefcd
test: LinkedUserDeleteServiceTest 테스트 코드 작성
1winhyun Dec 26, 2025
090eb89
test: LinkedUserGetServiceTest 테스트 코드 작성
1winhyun Dec 26, 2025
d80b3a7
test: LinkedUserSaveServiceTest 테스트 코드 작성
1winhyun Dec 26, 2025
199cc08
test: ReactionGetServiceTest 테스트 코드 작성
1winhyun Dec 26, 2025
e933b2a
test: ReactionSaveServiceTest 테스트 코드 작성
1winhyun Dec 26, 2025
149fcb1
refactor: FeedUpdateServiceTest 주석 수정
1winhyun Dec 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ dependencies {
// Test
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation "org.junit.jupiter:junit-jupiter:5.8.1"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

JUnit Jupiter 버전 업데이트를 권장합니다.

JUnit Jupiter 5.8.1은 2021년 9월 릴리스된 구버전입니다. JUnit 5 라인의 최신 안정 버전인 5.14.1 또는 현재 최신 버전인 6.0.1로 업그레이드하시기 바랍니다. 단, JUnit 6으로 업그레이드할 경우 Java 17 이상이 필요합니다.

🤖 Prompt for AI Agents
In build.gradle around line 44, the project pins JUnit Jupiter to 5.8.1 (old);
update the dependency to a recent stable release—replace testImplementation
"org.junit.jupiter:junit-jupiter:5.8.1" with testImplementation
"org.junit.jupiter:junit-jupiter:5.14.1" (or
"org.junit.jupiter:junit-jupiter:6.0.1" if you have Java 17+); ensure the
project Java compatibility in build.gradle
(sourceCompatibility/targetCompatibility or toolchain) matches the chosen JUnit
6 requirement if you pick 6.x.

testImplementation 'org.springframework.boot:spring-boot-starter-test'
Comment on lines +44 to +45
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

중복 의존성을 제거하세요.

Line 42와 Line 45에 spring-boot-starter-test가 중복 선언되어 있습니다. Line 45를 제거하세요.

🔎 중복 제거를 위한 제안
 testImplementation "org.junit.jupiter:junit-jupiter:5.8.1"
-testImplementation 'org.springframework.boot:spring-boot-starter-test'
 testImplementation 'org.springframework.boot:spring-boot-testcontainers'

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In build.gradle around lines 44 to 45, the dependency
'org.springframework.boot:spring-boot-starter-test' is declared twice (also
present at line 42); remove the duplicate declaration at line 45 so the project
only declares spring-boot-starter-test once, leaving the junit-jupiter
dependency intact.

testImplementation 'org.springframework.boot:spring-boot-testcontainers'
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.testcontainers:mysql'
testImplementation 'org.testcontainers:mongodb'

// S3
implementation("software.amazon.awssdk:s3:2.31.54")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
package leets.leenk.domain.notification.domain.entity;

import leets.leenk.domain.notification.domain.entity.enums.NotificationType;
import org.springframework.data.mongodb.core.mapping.Document;

import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.Id;
import leets.leenk.global.common.entity.BaseEntity;
import leets.leenk.global.common.entity.MongoBaseEntity;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

@SuperBuilder
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Document(collection = "notifications")
public class Notification extends BaseEntity {
public class Notification extends MongoBaseEntity {

@Id
private String id;

private Long userId;

@Enumerated(EnumType.STRING)
private NotificationType notificationType;

private Boolean isRead;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package leets.leenk.global.common.entity;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import java.time.LocalDateTime;

@Getter
@SuperBuilder
@NoArgsConstructor
public abstract class MongoBaseEntity {

@CreatedDate
private LocalDateTime createDate;

@LastModifiedDate
private LocalDateTime updateDate;
}
19 changes: 19 additions & 0 deletions src/test/java/leets/leenk/config/MysqlTestConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package leets.leenk.config;

import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.annotation.Bean;
import org.testcontainers.containers.MySQLContainer;

@TestConfiguration
public class MysqlTestConfig {

private static final String MYSQL_IMAGE = "mysql:8.0.41";

@Bean
@ServiceConnection
public MySQLContainer<?> mysqlContainer() {
return new MySQLContainer<>(MYSQL_IMAGE)
.withDatabaseName("testdb");
}
}
32 changes: 32 additions & 0 deletions src/test/java/leets/leenk/config/TestContainersTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package leets.leenk.config;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ActiveProfiles;
import org.testcontainers.containers.MySQLContainer;

import static org.assertj.core.api.Assertions.assertThat;

@DataJpaTest
@Import(MysqlTestConfig.class)
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
@ActiveProfiles("test")
class TestContainersTest {

@Autowired
private MySQLContainer<?> mysqlContainer;


@Test
void MySQL_컨테이너_정상_동작_테스트() {
// MySQL 컨테이너 테스트
assertThat(mysqlContainer).isNotNull();
assertThat(mysqlContainer.isRunning()).isTrue();
assertThat(mysqlContainer.getDatabaseName()).isEqualTo("testdb");

System.out.println("MySQL Container JDBC URL: " + mysqlContainer.getJdbcUrl());
}
}
Loading