Refactor code

- remove unnecessary test code
- remove comment domain service update assert statement
This commit is contained in:
Rebwon
2021-10-11 16:08:22 +09:00
committed by MaengSol
parent a9d7523f10
commit 865606ca68
3 changed files with 2 additions and 84 deletions

View File

@@ -1,34 +0,0 @@
package com.yam.app.article.infrastructure;
import static org.assertj.core.api.Assertions.assertThat;
import com.yam.app.article.domain.Article;
import com.yam.app.article.domain.ArticleReader;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
@SpringBootTest
@ActiveProfiles("test")
@Disabled
final class MybatisArticleRepositoryTests {
@Autowired
private ArticleReader articleReader;
@Test
void articleReader_find_by_title() {
Article article = articleReader.findByTitle("sample-title");
assertThat(article).isNotNull();
}
@Test
void articleReader_find_by_id() {
Article article = articleReader.findById(1L).get();
assertThat(article.getTags().size()).isEqualTo(3);
}
}

View File

@@ -47,15 +47,11 @@ final class CommentProcessorTest {
DynamicTest.dynamicTest("댓글 수정에 성공한다.",
() -> {
// Act
var modifiedAt = fakeCommentRepository.findById(commentId).get()
.getModifiedAt();
processor.update("new content", commentId, memberId);
var comment = fakeCommentRepository.findById(commentId).get();
var updateComment = fakeCommentRepository.findById(commentId).get();
// Assert
assertThat(comment.getContent()).isEqualTo("new content");
assertThat(comment.getModifiedAt().isAfter(modifiedAt)).isTrue();
assertThat(updateComment.getContent()).isEqualTo("new content");
}),
DynamicTest.dynamicTest("댓글 작성시 유효한 게시글이 존재하지 않는 경우 예외를 반환한다.",
() -> {

View File

@@ -1,44 +0,0 @@
package com.yam.app.comment.infrastructure;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import com.yam.app.comment.domain.CommentReader;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
@SpringBootTest
@ActiveProfiles("test")
@Disabled
final class MybatisCommentRepositoryTest {
@Autowired
CommentReader commentReader;
@Test
void findById() {
var comment = commentReader.findById(1L);
if (comment.isPresent()) {
assertThat(comment.get()).isNotNull();
} else {
fail("Comment Could not find");
}
}
@Test
void findByArticleId() {
var comments = commentReader.findByArticleId(1L);
assertThat(comments).extracting("articleId", Long.class)
.containsOnly(1L);
}
@Test
void existsById() {
var isPresent = commentReader.existsById(1L);
assertThat(isPresent).isTrue();
}
}