-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/test/java/com/nexters/covid/letter/domain/SendOptionRepositoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.nexters.covid.letter.domain; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||
|
||
@DataJpaTest | ||
public class SendOptionRepositoryTest { | ||
|
||
@Autowired | ||
SendOptionRepository sendOptionRepository; | ||
|
||
@Test | ||
void fetchJoinTest() { | ||
List<SendOption> options = sendOptionRepository.findAllJoinFetch(); | ||
|
||
assertThat(options.size()).isEqualTo(5); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
spring: | ||
datasource: | ||
driver-class-name: org.h2.Driver | ||
url: jdbc:h2:mem:testdb | ||
data: classpath:data-h2.sql | ||
h2: | ||
console: | ||
enabled: true | ||
jpa: | ||
defer-datasource-initialization: true | ||
show-sql: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
insert into user (email, identifier, name) values ('email', 'identifier', 'name'); | ||
|
||
insert into letter (answer, contents, encrypted_id, letter_to, email, sticker, question_id, state, title, user_id) | ||
values ('ANSWER', 'CONTENTS', 'ENCRYPTED', 'LETTER_TO', 'email', 'A', 'HAPPY', 'PENDING', 'TITLE', 1); | ||
insert into letter (answer, contents, encrypted_id, letter_to, email, sticker, question_id, state, title, user_id) | ||
values ('ANSWER1', 'CONTENTS1', 'ENCRYPTED1', 'LETTER_TO1', 'email', 'A', 'BLUE', 'PENDING', 'TITLE1', 1); | ||
|
||
insert into send_option (text, covid_stat) values ('테스트', 1000); | ||
insert into send_option (text, covid_stat) values ('테스트2', 2000); | ||
|
||
insert into question (text, send_option_id) values ('테스트1에 1', 1); | ||
insert into question (text, send_option_id) values ('테스트1에 2', 1); | ||
insert into question (text, send_option_id) values ('테스트1에 3', 1); | ||
|
||
insert into question (text, send_option_id) values ('테스트2에 1', 2); | ||
insert into question (text, send_option_id) values ('테스트2에 2', 2); |