diff --git a/app/src/main/java/hous/release/android/presentation/our_rules/component/main/MainRuleContent.kt b/app/src/main/java/hous/release/android/presentation/our_rules/component/main/MainRuleContent.kt index 56e97923..9103f18c 100644 --- a/app/src/main/java/hous/release/android/presentation/our_rules/component/main/MainRuleContent.kt +++ b/app/src/main/java/hous/release/android/presentation/our_rules/component/main/MainRuleContent.kt @@ -20,12 +20,12 @@ import hous.release.designsystem.component.FabScreenSlot import hous.release.designsystem.component.HousTextField import hous.release.designsystem.component.HousTextFieldMode import hous.release.designsystem.theme.HousTheme -import hous.release.domain.entity.rule.MainRule +import hous.release.domain.entity.rule.Rule import hous.release.feature.todo.R @Composable fun MainRuleContent( - mainRules: List = emptyList(), + mainRules: List = emptyList(), searchQuery: String = "", onSearch: (String) -> Unit = {}, onOpenDetailRule: (Int) -> Unit = {}, @@ -83,10 +83,10 @@ private fun MainRuleScreenPreView2() { HousTheme { MainRuleContent( mainRules = listOf( - MainRule().copy(id = 1, name = "test1", isNew = true), - MainRule().copy(id = 2, name = "test2", isNew = false), - MainRule().copy(id = 3, name = "test3", isNew = true), - MainRule().copy(id = 4, name = "test4", isNew = false) + Rule().copy(id = 1, name = "test1", isNew = true), + Rule().copy(id = 2, name = "test2", isNew = false), + Rule().copy(id = 3, name = "test3", isNew = true), + Rule().copy(id = 4, name = "test4", isNew = false) ) ) } diff --git a/app/src/main/java/hous/release/android/presentation/our_rules/component/main/MainRuleList.kt b/app/src/main/java/hous/release/android/presentation/our_rules/component/main/MainRuleList.kt index 48bcf25c..327bd6ad 100644 --- a/app/src/main/java/hous/release/android/presentation/our_rules/component/main/MainRuleList.kt +++ b/app/src/main/java/hous/release/android/presentation/our_rules/component/main/MainRuleList.kt @@ -24,12 +24,12 @@ import hous.release.designsystem.component.HousRuleSlot import hous.release.designsystem.theme.HousBlue import hous.release.designsystem.theme.HousG5 import hous.release.designsystem.theme.HousTheme -import hous.release.domain.entity.rule.MainRule +import hous.release.domain.entity.rule.Rule @Composable fun MainRuleList( onNavigateToDetailRule: (Int) -> Unit = {}, - mainRules: List = emptyList() + mainRules: List = emptyList() ) { if (mainRules.isEmpty()) { MainRuleEmptyContent() @@ -63,7 +63,7 @@ private fun MainRuleEmptyContent() { @Composable private fun MainRuleItem( onClick: () -> Unit = {}, - mainRule: MainRule = MainRule() + mainRule: Rule = Rule() ) { val focusManager = LocalFocusManager.current HousRuleSlot( @@ -106,10 +106,10 @@ private fun MainRuleContentPreview() { HousTheme { MainRuleList( mainRules = listOf( - MainRule().copy(id = 1, name = "test1", isNew = true), - MainRule().copy(id = 2, name = "test2", isNew = false), - MainRule().copy(id = 3, name = "test3", isNew = true), - MainRule().copy(id = 4, name = "test4", isNew = false) + Rule().copy(id = 1, name = "test1", isNew = true), + Rule().copy(id = 2, name = "test2", isNew = false), + Rule().copy(id = 3, name = "test3", isNew = true), + Rule().copy(id = 4, name = "test4", isNew = false) ) ) } @@ -131,7 +131,7 @@ private fun NewMainRulePreview() { HousTheme { Surface { MainRuleItem( - mainRule = MainRule().copy(isNew = true) + mainRule = Rule().copy(isNew = true) ) } } diff --git a/app/src/main/java/hous/release/android/presentation/our_rules/screen/MainRuleScreen.kt b/app/src/main/java/hous/release/android/presentation/our_rules/screen/MainRuleScreen.kt index 0cc71cba..2ecf8e61 100644 --- a/app/src/main/java/hous/release/android/presentation/our_rules/screen/MainRuleScreen.kt +++ b/app/src/main/java/hous/release/android/presentation/our_rules/screen/MainRuleScreen.kt @@ -24,14 +24,14 @@ import hous.release.android.presentation.our_rules.component.main.MainRuleConten import hous.release.android.presentation.our_rules.model.DetailRuleUiModel import hous.release.designsystem.theme.HousTheme import hous.release.designsystem.theme.HousWhite -import hous.release.domain.entity.rule.MainRule +import hous.release.domain.entity.rule.Rule import kotlinx.coroutines.launch @OptIn(ExperimentalMaterialApi::class) @Composable fun MainRuleScreen( detailRule: DetailRuleUiModel = DetailRuleUiModel(), - mainRules: List = emptyList(), + mainRules: List = emptyList(), searchQuery: String = "", fetchDetailRuleById: (Int) -> Unit = {}, deleteRule: () -> Unit = {}, @@ -119,10 +119,10 @@ private fun MainRuleScreenPreView2() { HousTheme { MainRuleScreen( mainRules = listOf( - MainRule().copy(id = 1, name = "test1", isNew = true), - MainRule().copy(id = 2, name = "test2", isNew = false), - MainRule().copy(id = 3, name = "test3", isNew = true), - MainRule().copy(id = 4, name = "test4", isNew = false) + Rule().copy(id = 1, name = "test1", isNew = true), + Rule().copy(id = 2, name = "test2", isNew = false), + Rule().copy(id = 3, name = "test3", isNew = true), + Rule().copy(id = 4, name = "test4", isNew = false) ) ) } diff --git a/app/src/main/java/hous/release/android/presentation/our_rules/viewmodel/MainRuleViewModel.kt b/app/src/main/java/hous/release/android/presentation/our_rules/viewmodel/MainRuleViewModel.kt index e4ab8f79..b4986084 100644 --- a/app/src/main/java/hous/release/android/presentation/our_rules/viewmodel/MainRuleViewModel.kt +++ b/app/src/main/java/hous/release/android/presentation/our_rules/viewmodel/MainRuleViewModel.kt @@ -8,12 +8,12 @@ import hous.release.android.presentation.our_rules.model.DetailRuleUiModel import hous.release.android.util.event.Reducer import hous.release.domain.entity.Photo import hous.release.domain.entity.rule.DetailRule -import hous.release.domain.entity.rule.MainRule +import hous.release.domain.entity.rule.Rule import hous.release.domain.repository.PhotoRepository import hous.release.domain.usecase.rule.CanAddRuleUseCase import hous.release.domain.usecase.rule.DeleteRuleUseCase import hous.release.domain.usecase.rule.GetDetailRuleUseCase -import hous.release.domain.usecase.rule.GetMainRulesUseCase +import hous.release.domain.usecase.rule.GetRulesUseCase import hous.release.domain.usecase.search.SearchRuleUseCase import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.SharingStarted @@ -27,7 +27,7 @@ import javax.inject.Inject @HiltViewModel class MainRuleViewModel @Inject constructor( private val photoSaver: PhotoRepository, - private val getMainRulesUseCase: GetMainRulesUseCase, + private val getMainRulesUseCase: GetRulesUseCase, private val getDetailRuleUseCase: GetDetailRuleUseCase, private val canAddRuleUseCase: CanAddRuleUseCase, private val deleteRuleUseCase: DeleteRuleUseCase, @@ -120,10 +120,10 @@ sealed class MainRuleSideEffect { sealed class MainRulesEvent { data class LoadedImage(val photos: List) : MainRulesEvent() - data class Refresh(val rules: List) : MainRulesEvent() - data class FetchMainRules(val rules: List) : MainRulesEvent() + data class Refresh(val rules: List) : MainRulesEvent() + data class FetchMainRules(val rules: List) : MainRulesEvent() data class FetchDetailRule(val rule: DetailRule) : MainRulesEvent() - data class SearchRule(val searchQuery: String, val filteredRules: List) : + data class SearchRule(val searchQuery: String, val filteredRules: List) : MainRulesEvent() object DeleteAllFile : MainRulesEvent() @@ -131,7 +131,7 @@ sealed class MainRulesEvent { data class MainRulesState( val detailRule: DetailRuleUiModel = DetailRuleUiModel(), - val originRules: List = emptyList(), - val filteredRules: List = emptyList(), + val originRules: List = emptyList(), + val filteredRules: List = emptyList(), val searchQuery: String = "" ) diff --git a/data/src/main/java/hous/release/data/datasource/RuleDataSource.kt b/data/src/main/java/hous/release/data/datasource/RuleDataSource.kt index 703fe56f..88268537 100644 --- a/data/src/main/java/hous/release/data/datasource/RuleDataSource.kt +++ b/data/src/main/java/hous/release/data/datasource/RuleDataSource.kt @@ -4,15 +4,15 @@ import hous.release.data.entity.request.rule.AddRulesRequest import hous.release.data.entity.request.rule.UpdateRuleRequest import hous.release.data.entity.response.NoDataResponse import hous.release.data.entity.response.rule.DetailRuleResponse -import hous.release.data.entity.response.rule.MainRulesResponse +import hous.release.data.entity.response.rule.RulesResponse import hous.release.data.service.RuleService import hous.release.data.util.multipart.toImagePart import javax.inject.Inject class RuleDataSource @Inject constructor(private val ruleService: RuleService) { - suspend fun fetchMainRules(): MainRulesResponse = - ruleService.getMainRules().data + suspend fun fetchRules(): RulesResponse = + ruleService.getRules().data suspend fun fetchDetailRuleBy(id: Int): DetailRuleResponse = ruleService.getDetailRuleBy(id).data diff --git a/data/src/main/java/hous/release/data/entity/response/rule/MainRulesResponse.kt b/data/src/main/java/hous/release/data/entity/response/rule/RulesResponse.kt similarity index 66% rename from data/src/main/java/hous/release/data/entity/response/rule/MainRulesResponse.kt rename to data/src/main/java/hous/release/data/entity/response/rule/RulesResponse.kt index 1ca2137b..ccc1bbec 100644 --- a/data/src/main/java/hous/release/data/entity/response/rule/MainRulesResponse.kt +++ b/data/src/main/java/hous/release/data/entity/response/rule/RulesResponse.kt @@ -1,19 +1,19 @@ package hous.release.data.entity.response.rule -import hous.release.domain.entity.rule.MainRule +import hous.release.domain.entity.rule.Rule -data class MainRulesResponse( - val rules: List = emptyList() +data class RulesResponse( + val rules: List = emptyList() ) -data class MainRuleResponse( +data class RuleResponse( val id: Int = -1, val name: String = "", val isRepresent: Boolean = false, val createdAt: String = "", val isNew: Boolean = false ) { - fun toMainRule() = MainRule( + fun toRule() = Rule( id = id, name = name, isRepresent = isRepresent, diff --git a/data/src/main/java/hous/release/data/repository/RuleRepositoryImpl.kt b/data/src/main/java/hous/release/data/repository/RuleRepositoryImpl.kt index cb482609..64d61f8e 100644 --- a/data/src/main/java/hous/release/data/repository/RuleRepositoryImpl.kt +++ b/data/src/main/java/hous/release/data/repository/RuleRepositoryImpl.kt @@ -4,7 +4,7 @@ import hous.release.data.datasource.RuleDataSource import hous.release.data.entity.request.rule.AddRulesRequest import hous.release.data.entity.request.rule.UpdateRuleRequest import hous.release.domain.entity.rule.DetailRule -import hous.release.domain.entity.rule.MainRule +import hous.release.domain.entity.rule.Rule import hous.release.domain.repository.RuleRepository import kotlinx.coroutines.CoroutineDispatcher import java.io.File @@ -15,8 +15,8 @@ class RuleRepositoryImpl @Inject constructor( private val ioDispatcher: CoroutineDispatcher ) : RuleRepository { - override suspend fun fetchMainRules(): List = - ruleDataSource.fetchMainRules().rules.map { it.toMainRule() } + override suspend fun fetchRules(): List = + ruleDataSource.fetchRules().rules.map { it.toRule() } override suspend fun fetchDetailRule(id: Int): DetailRule = ruleDataSource.fetchDetailRuleBy(id).toDetailRule() diff --git a/data/src/main/java/hous/release/data/service/RuleService.kt b/data/src/main/java/hous/release/data/service/RuleService.kt index 12d6a2c5..1180c6d9 100644 --- a/data/src/main/java/hous/release/data/service/RuleService.kt +++ b/data/src/main/java/hous/release/data/service/RuleService.kt @@ -4,7 +4,7 @@ import hous.release.data.entity.response.BaseResponse import hous.release.data.entity.response.NoDataResponse import hous.release.data.entity.response.rule.CanAddRuleResponse import hous.release.data.entity.response.rule.DetailRuleResponse -import hous.release.data.entity.response.rule.MainRulesResponse +import hous.release.data.entity.response.rule.RulesResponse import okhttp3.MultipartBody import retrofit2.http.GET import retrofit2.http.HTTP @@ -17,7 +17,7 @@ import retrofit2.http.Query interface RuleService { @GET("/v1/rules") - suspend fun getMainRules(): BaseResponse + suspend fun getRules(): BaseResponse @GET("/v2/rule/{id}") suspend fun getDetailRuleBy(@Path("id") id: Int): BaseResponse diff --git a/data/src/test/java/hous/release/data/repository/RuleRepositoryImplTest.kt b/data/src/test/java/hous/release/data/repository/RuleRepositoryImplTest.kt index 210999f1..a1b90e6d 100644 --- a/data/src/test/java/hous/release/data/repository/RuleRepositoryImplTest.kt +++ b/data/src/test/java/hous/release/data/repository/RuleRepositoryImplTest.kt @@ -2,9 +2,9 @@ package hous.release.data.repository import com.google.common.truth.Truth.assertThat import hous.release.data.datasource.RuleDataSource -import hous.release.data.entity.response.rule.MainRuleResponse -import hous.release.data.entity.response.rule.MainRulesResponse -import hous.release.domain.entity.rule.MainRule +import hous.release.data.entity.response.rule.RuleResponse +import hous.release.data.entity.response.rule.RulesResponse +import hous.release.domain.entity.rule.Rule import io.mockk.coEvery import io.mockk.impl.annotations.RelaxedMockK import io.mockk.junit5.MockKExtension @@ -32,14 +32,14 @@ internal class RuleRepositoryImplTest { fun `MainRulesResponse 객체 에서 MainRule로 변환 하여 규칙들을 불러 온다`() = runTest { // given val expectedMainRules = listOf( - MainRule( + Rule( 34, "dd123xd", true, "2023.03.16", true ), - MainRule( + Rule( 35, "ㄷ슏슛ㄷ", true, @@ -48,17 +48,17 @@ internal class RuleRepositoryImplTest { ) ) coEvery { - ruleDataSource.fetchMainRules() - } returns MainRulesResponse( + ruleDataSource.fetchRules() + } returns RulesResponse( rules = listOf( - MainRuleResponse( + RuleResponse( 34, "dd123xd", true, "2023-03-16T17:19:42.158498", true ), - MainRuleResponse( + RuleResponse( 35, "ㄷ슏슛ㄷ", true, @@ -69,7 +69,7 @@ internal class RuleRepositoryImplTest { ) // when - val actualRules = defaultRuleRepository.fetchMainRules() + val actualRules = defaultRuleRepository.fetchRules() // then assertThat(actualRules).isEqualTo(expectedMainRules) } diff --git a/data/src/test/java/hous/release/data/service/RuleServiceTest.kt b/data/src/test/java/hous/release/data/service/RuleServiceTest.kt index bf9bf242..ded5bc24 100644 --- a/data/src/test/java/hous/release/data/service/RuleServiceTest.kt +++ b/data/src/test/java/hous/release/data/service/RuleServiceTest.kt @@ -4,8 +4,8 @@ import com.google.common.truth.Truth.assertThat import com.google.gson.GsonBuilder import hous.release.data.entity.response.BaseResponse import hous.release.data.entity.response.rule.DetailRuleResponse -import hous.release.data.entity.response.rule.MainRuleResponse -import hous.release.data.entity.response.rule.MainRulesResponse +import hous.release.data.entity.response.rule.RuleResponse +import hous.release.data.entity.response.rule.RulesResponse import io.mockk.junit5.MockKExtension import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest @@ -43,16 +43,16 @@ internal class RuleServiceTest { status = 200, success = true, message = "규칙 메인 페이지 조회 성공입니다.", - data = MainRulesResponse( + data = RulesResponse( rules = listOf( - MainRuleResponse( + RuleResponse( 34, "dd123xd", true, "2023-03-16T17:19:42.158498", true ), - MainRuleResponse( + RuleResponse( 35, "ㄷ슏슛ㄷ", false, @@ -63,7 +63,7 @@ internal class RuleServiceTest { ) ) // when - val actualResponse = ruleService.getMainRules() + val actualResponse = ruleService.getRules() // then assertThat(actualResponse).isEqualTo(expectedResponse) } diff --git a/domain/src/main/java/hous/release/domain/entity/Rule.kt b/domain/src/main/java/hous/release/domain/entity/BaseRule.kt similarity index 77% rename from domain/src/main/java/hous/release/domain/entity/Rule.kt rename to domain/src/main/java/hous/release/domain/entity/BaseRule.kt index 323bdd26..6642b1ec 100644 --- a/domain/src/main/java/hous/release/domain/entity/Rule.kt +++ b/domain/src/main/java/hous/release/domain/entity/BaseRule.kt @@ -1,6 +1,6 @@ package hous.release.domain.entity -abstract class Rule( +abstract class BaseRule( open val id: Int, open val name: String ) diff --git a/domain/src/main/java/hous/release/domain/entity/rule/DetailRule.kt b/domain/src/main/java/hous/release/domain/entity/rule/DetailRule.kt index ccc00779..bf17e277 100644 --- a/domain/src/main/java/hous/release/domain/entity/rule/DetailRule.kt +++ b/domain/src/main/java/hous/release/domain/entity/rule/DetailRule.kt @@ -1,7 +1,7 @@ package hous.release.domain.entity.rule import hous.release.domain.entity.Photo -import hous.release.domain.entity.Rule +import hous.release.domain.entity.BaseRule data class DetailRule( override val id: Int = NO_ID, @@ -9,7 +9,7 @@ data class DetailRule( val description: String = NO_DESCRIPTION, val images: List = emptyList(), val updatedAt: String = "" -) : Rule(id, name) { +) : BaseRule(id, name) { companion object { private const val NO_NAME = "제목 없음" private const val NO_DESCRIPTION = "설명 없음" diff --git a/domain/src/main/java/hous/release/domain/entity/rule/OurRulesContent.kt b/domain/src/main/java/hous/release/domain/entity/rule/OurRulesContent.kt deleted file mode 100644 index 3e28311c..00000000 --- a/domain/src/main/java/hous/release/domain/entity/rule/OurRulesContent.kt +++ /dev/null @@ -1,15 +0,0 @@ -package hous.release.domain.entity.rule - -data class OurRulesContent( - val ourRuleList: List = defaultRuleList, - val isEmptyRepresentativeRuleList: Boolean = true, - val isEmptyGeneralRuleList: Boolean = true -) { - companion object { - val defaultRuleList = listOf( - MainRule(), - MainRule(), - MainRule() - ) - } -} diff --git a/domain/src/main/java/hous/release/domain/entity/rule/MainRule.kt b/domain/src/main/java/hous/release/domain/entity/rule/Rule.kt similarity index 80% rename from domain/src/main/java/hous/release/domain/entity/rule/MainRule.kt rename to domain/src/main/java/hous/release/domain/entity/rule/Rule.kt index b0a0a867..7a850472 100644 --- a/domain/src/main/java/hous/release/domain/entity/rule/MainRule.kt +++ b/domain/src/main/java/hous/release/domain/entity/rule/Rule.kt @@ -1,14 +1,14 @@ package hous.release.domain.entity.rule -import hous.release.domain.entity.Rule +import hous.release.domain.entity.BaseRule -data class MainRule( +data class Rule( override val id: Int = NO_ID, override val name: String = NO_NAME, val isRepresent: Boolean = false, val createdAt: String = "", val isNew: Boolean = false -) : Rule(id, name) { +) : BaseRule(id, name) { companion object { private const val NO_NAME = "다른 Rule도 추가해보세요!" private const val NO_ID = -1 diff --git a/domain/src/main/java/hous/release/domain/entity/todo/TodoWithNew.kt b/domain/src/main/java/hous/release/domain/entity/todo/TodoWithNew.kt index dc1dca5c..8193dd24 100644 --- a/domain/src/main/java/hous/release/domain/entity/todo/TodoWithNew.kt +++ b/domain/src/main/java/hous/release/domain/entity/todo/TodoWithNew.kt @@ -1,9 +1,9 @@ package hous.release.domain.entity.todo -import hous.release.domain.entity.Rule +import hous.release.domain.entity.BaseRule data class TodoWithNew( val isNew: Boolean, override val id: Int, override val name: String -) : Rule(id, name) +) : BaseRule(id, name) diff --git a/domain/src/main/java/hous/release/domain/repository/RuleRepository.kt b/domain/src/main/java/hous/release/domain/repository/RuleRepository.kt index 395df8ba..1b45e50a 100644 --- a/domain/src/main/java/hous/release/domain/repository/RuleRepository.kt +++ b/domain/src/main/java/hous/release/domain/repository/RuleRepository.kt @@ -1,11 +1,11 @@ package hous.release.domain.repository import hous.release.domain.entity.rule.DetailRule -import hous.release.domain.entity.rule.MainRule +import hous.release.domain.entity.rule.Rule import java.io.File interface RuleRepository { - suspend fun fetchMainRules(): List + suspend fun fetchRules(): List suspend fun fetchDetailRule(id: Int): DetailRule suspend fun canAddRule(): Boolean diff --git a/domain/src/main/java/hous/release/domain/usecase/rule/GetMainRulesUseCase.kt b/domain/src/main/java/hous/release/domain/usecase/rule/GetMainRulesUseCase.kt deleted file mode 100644 index cf5fcefc..00000000 --- a/domain/src/main/java/hous/release/domain/usecase/rule/GetMainRulesUseCase.kt +++ /dev/null @@ -1,10 +0,0 @@ -package hous.release.domain.usecase.rule - -import hous.release.domain.entity.rule.MainRule -import hous.release.domain.repository.RuleRepository -import javax.inject.Inject - -class GetMainRulesUseCase @Inject constructor(private val repository: RuleRepository) { - - suspend operator fun invoke(): List = repository.fetchMainRules() -} diff --git a/domain/src/main/java/hous/release/domain/usecase/rule/GetRulesUseCase.kt b/domain/src/main/java/hous/release/domain/usecase/rule/GetRulesUseCase.kt new file mode 100644 index 00000000..151bbdb5 --- /dev/null +++ b/domain/src/main/java/hous/release/domain/usecase/rule/GetRulesUseCase.kt @@ -0,0 +1,10 @@ +package hous.release.domain.usecase.rule + +import hous.release.domain.entity.rule.Rule +import hous.release.domain.repository.RuleRepository +import javax.inject.Inject + +class GetRulesUseCase @Inject constructor(private val repository: RuleRepository) { + + suspend operator fun invoke(): List = repository.fetchRules() +} diff --git a/domain/src/main/java/hous/release/domain/usecase/search/SearchRuleUseCase.kt b/domain/src/main/java/hous/release/domain/usecase/search/SearchRuleUseCase.kt index b3379883..82f4c979 100644 --- a/domain/src/main/java/hous/release/domain/usecase/search/SearchRuleUseCase.kt +++ b/domain/src/main/java/hous/release/domain/usecase/search/SearchRuleUseCase.kt @@ -1,13 +1,13 @@ package hous.release.domain.usecase.search -import hous.release.domain.entity.Rule +import hous.release.domain.entity.BaseRule import hous.release.domain.usecase.search.matcher.StringMatcher import javax.inject.Inject class SearchRuleUseCase @Inject constructor( private val matcher: StringMatcher ) { - operator fun invoke(search: String, rules: List): List { + operator fun invoke(search: String, rules: List): List { return rules.filter { rule -> matcher.isMatched(search, rule.name) } diff --git a/domain/src/test/java/hous/release/domain/usecase/SearchRuleUseCaseTest.kt b/domain/src/test/java/hous/release/domain/usecase/SearchRuleUseCaseTest.kt index eb4fe2ad..80e6fad7 100644 --- a/domain/src/test/java/hous/release/domain/usecase/SearchRuleUseCaseTest.kt +++ b/domain/src/test/java/hous/release/domain/usecase/SearchRuleUseCaseTest.kt @@ -1,7 +1,7 @@ package hous.release.domain.usecase import com.google.common.truth.Truth.assertThat -import hous.release.domain.entity.Rule +import hous.release.domain.entity.BaseRule import hous.release.domain.usecase.search.SearchRuleUseCase import hous.release.domain.usecase.search.matcher.RuleNameMatcher import hous.release.domain.usecase.search.strategy.MixedEnKrMatchStrategy @@ -14,14 +14,14 @@ internal class SearchRuleUseCaseTest { val isNew: Boolean = false, override val id: Int = 0, override val name: String = "" - ) : Rule(id, name) + ) : BaseRule(id, name) @Test fun `rule의 name에 검색값이 매칭되는 rule을 반환한다`() { // given val searchUseCase = SearchRuleUseCase(RuleNameMatcher(MixedEnKrMatchStrategy())) - val rules: List = + val rules: List = listOf( MainTodo(name = "이준원"), MainTodo(name = " 이준원MURJUNE "), @@ -29,12 +29,12 @@ internal class SearchRuleUseCaseTest { MainTodo(name = "이#준@원") ) // when - val res: List = searchUseCase("ㄱㄱ", rules) - val res2: List = searchUseCase("ㅇㅈㅇ", rules) - val res3: List = searchUseCase("muㅕrj&une", rules) + val res: List = searchUseCase("ㄱㄱ", rules) + val res2: List = searchUseCase("ㅇㅈㅇ", rules) + val res3: List = searchUseCase("muㅕrj&une", rules) // then assertAll( - { assertThat(res).isEqualTo(emptyList()) }, + { assertThat(res).isEqualTo(emptyList()) }, { assertThat(res2).isEqualTo(rules) }, { assertThat(res3).isEqualTo(