-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
e7e6f2d
commit b73b992
Showing
1 changed file
with
74 additions
and
0 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
src/test/java/com/owori/domain/story/service/FacadeServiceTest.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,74 @@ | ||
package com.owori.domain.story.service; | ||
|
||
import com.owori.domain.family.entity.Family; | ||
import com.owori.domain.family.repository.FamilyRepository; | ||
import com.owori.domain.member.entity.Member; | ||
import com.owori.domain.story.dto.response.FindStoryResponse; | ||
import com.owori.domain.story.entity.Story; | ||
import com.owori.domain.story.repository.StoryRepository; | ||
import com.owori.support.database.DatabaseTest; | ||
import com.owori.support.database.LoginTest; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import java.time.LocalDate; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@DatabaseTest | ||
@DisplayName("Facade 서비스의") | ||
public class FacadeServiceTest extends LoginTest { | ||
|
||
@Autowired | ||
private FacadeService facadeService; | ||
|
||
@Autowired | ||
private FamilyRepository familyRepository; | ||
|
||
@Autowired | ||
private StoryRepository storyRepository; | ||
|
||
|
||
@Test | ||
@DisplayName("id로 Story 조회가 잘 이루어지는가") | ||
void findStory() { | ||
//given | ||
Member member = authService.getLoginUser(); | ||
Family family = new Family("우리집", member, "code"); | ||
String title = "기다리고 기다리던 하루"; | ||
Story story = new Story(title, "내용", LocalDate.parse("2017-12-25"), LocalDate.parse("2017-12-30"), member); | ||
|
||
familyRepository.save(family); | ||
storyRepository.save(story); | ||
|
||
//when | ||
FindStoryResponse findStory = facadeService.findStory(story.getId()); | ||
|
||
//then | ||
assertThat(findStory.getStoryId()).isEqualTo(story.getId()); | ||
assertThat(findStory.getTitle()).isEqualTo(title); | ||
|
||
} | ||
|
||
@Test | ||
@DisplayName("id로 Story Entity 조회가 잘 이루어지는가") | ||
void loadStoryEntity() { | ||
//given | ||
Member member = authService.getLoginUser(); | ||
Family family = new Family("우리집", member, "code"); | ||
String title = "기다리고 기다리던 하루"; | ||
Story story = new Story(title, "내용", LocalDate.parse("2017-12-25"), LocalDate.parse("2017-12-30"), member); | ||
|
||
familyRepository.save(family); | ||
storyRepository.save(story); | ||
|
||
//when | ||
Story findStory = facadeService.loadStoryEntity(story.getId()); | ||
|
||
//then | ||
assertThat(findStory.getId()).isEqualTo(story.getId()); | ||
assertThat(findStory.getTitle()).isEqualTo(title); | ||
|
||
} | ||
} |