fix : create Article Repository Test Code. Add One Data because compare DateTime Between Two Data

This commit is contained in:
minseokkang
2022-10-24 17:54:17 +09:00
parent eb14420e94
commit 0054e3c108
2 changed files with 6 additions and 3 deletions

View File

@@ -59,7 +59,7 @@ class ArticleControllerTest {
String title = "create title";
slug = title.toLowerCase().replace(' ','-');
articleResponse = ArticleResponse.builder()
.author(ProfileResponse.builder().bio("bio")
.author(ArticleResponse.Author.builder().bio("bio")
.following(false)
.username("madeArticle")
.image("image")

View File

@@ -62,15 +62,18 @@ class ArticleRepositoryTest {
void createArticle() {
Optional<Article> savedArticle = articleRepository.findById(article.getId());
Article article2 = Article.builder().author(author).title("title").body("body").description("description").slug("slug").build();
articleRepository.save(article2);
assertThat(article.getBody()).isEqualTo(savedArticle.get().getBody());
assertThat(article.getDescription()).isEqualTo(savedArticle.get().getDescription());
assertThat(article.getId()).isEqualTo(savedArticle.get().getId());
assertThat(article.getTitle()).isEqualTo(savedArticle.get().getTitle());
assertThat(article.getSlug()).isEqualTo(savedArticle.get().getSlug());
assertThat(article.getTagList()).isEmpty();
assertThat(article.getCreatedDate()).isAfter(beforeCreated);
assertThat(article.getCreatedDate()).isBefore(article2.getCreatedDate());
assertThat(article.getFavorites()).isEmpty();
assertThat(article.getModifiedDate()).isAfter(beforeCreated);
assertThat(article.getModifiedDate()).isBefore(article2.getModifiedDate());
}