-
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.
Test: add get all categories business
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/test/java/com/sirius/spurt/service/business/category/GetAllCategoryBusinessTest.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,34 @@ | ||
package com.sirius.spurt.service.business.category; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.sirius.spurt.common.meta.Category; | ||
import com.sirius.spurt.service.business.category.GetAllCategoryBusiness.Dto; | ||
import com.sirius.spurt.service.business.category.GetAllCategoryBusiness.Result; | ||
import com.sirius.spurt.service.business.category.GetAllCategoryBusiness.Result.ResultCategory; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class GetAllCategoryBusinessTest { | ||
@InjectMocks private GetAllCategoryBusiness getAllCategoryBusiness; | ||
|
||
@Test | ||
void 카테고리_전체_조회_테스트() { | ||
// given | ||
|
||
// when | ||
Result result = getAllCategoryBusiness.execute(new Dto()); | ||
|
||
// then | ||
List<String> categories = | ||
result.getCategoryList().stream().map(ResultCategory::getValue).toList(); | ||
List<String> expectedCategories = | ||
Arrays.stream(Category.values()).map(Category::getValue).toList(); | ||
assertThat(categories).containsAll(expectedCategories); | ||
} | ||
} |