Skip to content

Commit

Permalink
Test: add get all categories business
Browse files Browse the repository at this point in the history
  • Loading branch information
emost22 committed Jun 22, 2024
1 parent 689d9bc commit 7b4794d
Showing 1 changed file with 34 additions and 0 deletions.
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);
}
}

0 comments on commit 7b4794d

Please sign in to comment.