-
Notifications
You must be signed in to change notification settings - Fork 1
[LNK-44] 피드 테스트 코드 작성 #81
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
base: dev
Are you sure you want to change the base?
The head ref may contain hidden characters: "LNK-44-Leenk-\uD53C\uB4DC-\uD14C\uC2A4\uD2B8-\uCF54\uB4DC-\uC791\uC131"
Changes from all commits
9c76b46
a2b6696
0c39523
db08450
e19b1f4
ea89714
5bd6b9d
c934809
0bb26fa
05cc746
4af544c
d0bb557
3522a39
5d483b2
be689b3
7fbc671
cb025c5
59e63d6
5422d99
8deefcd
090eb89
d80b3a7
199cc08
e933b2a
149fcb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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" | ||
| testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
|
Comment on lines
+44
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 중복 의존성을 제거하세요. Line 42와 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'
🤖 Prompt for AI Agents |
||
| 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") | ||
|
|
||
| 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; | ||
| } |
| 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"); | ||
| } | ||
| } |
| 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()); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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