-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#54] test: ArticleSlugConverter 테스트 작성
- Loading branch information
Showing
5 changed files
with
35 additions
and
15 deletions.
There are no files selected for viewing
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
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
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
26 changes: 23 additions & 3 deletions
26
src/test/java/com/study/realworld/domain/article/api/converter/ArticleSlugConverterTest.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 |
---|---|---|
@@ -1,13 +1,33 @@ | ||
package com.study.realworld.domain.article.api.converter; | ||
|
||
import com.study.realworld.domain.article.api.converter.ArticleSlugConverter.ArticleSlugToStringConverter; | ||
import com.study.realworld.domain.article.api.converter.ArticleSlugConverter.StringToArticleSlugConverter; | ||
import com.study.realworld.domain.article.domain.vo.ArticleSlug; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@DisplayName("게시글 슬러그 컨버터(ArticleSlugConverter)") | ||
class ArticleSlugConverterTest { | ||
|
||
@Test | ||
void test() { | ||
@ParameterizedTest(name = "입력값 : {0}") | ||
@ValueSource(strings = {"a", "ab", "abc"}) | ||
void 문자열을_객체로_변환할_수_있다(String slugString) { | ||
final StringToArticleSlugConverter converter = new StringToArticleSlugConverter(); | ||
final ArticleSlug articleSlug = converter.convert(slugString); | ||
|
||
assertThat(articleSlug.articleSlug()).isEqualTo(slugString); | ||
} | ||
|
||
@ParameterizedTest(name = "입력값 : {0}") | ||
@ValueSource(strings = {"a", "ab", "abc"}) | ||
void 객체를_문자열로_변환할_수_있다(String slugString) { | ||
final ArticleSlug articleSlug = ArticleSlug.from(slugString); | ||
final ArticleSlugToStringConverter converter = new ArticleSlugToStringConverter(); | ||
final String actual = converter.convert(articleSlug); | ||
|
||
assertThat(actual).isEqualTo(slugString); | ||
} | ||
} |
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