Skip to content

Commit

Permalink
refactor: (#141) queryUserPort → scheduleQueryUserPort
Browse files Browse the repository at this point in the history
  • Loading branch information
khcho0125 committed Nov 22, 2022
1 parent 045110b commit 7e7306c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import team.comit.simtong.domain.schedule.dto.ChangeSpotScheduleRequest
import team.comit.simtong.domain.schedule.exception.ScheduleNotFoundException
import team.comit.simtong.domain.schedule.spi.CommandSchedulePort
import team.comit.simtong.domain.schedule.spi.QuerySchedulePort
import team.comit.simtong.domain.schedule.spi.ScheduleQueryUserPort
import team.comit.simtong.domain.schedule.spi.ScheduleSecurityPort
import team.comit.simtong.domain.user.exception.NotEnoughPermissionException
import team.comit.simtong.domain.user.exception.UserNotFoundException
import team.comit.simtong.domain.user.model.Authority
import team.comit.simtong.domain.user.spi.QueryUserPort
import team.comit.simtong.global.annotation.UseCase

/**
Expand All @@ -21,7 +21,7 @@ import team.comit.simtong.global.annotation.UseCase
**/
@UseCase
class ChangeSpotScheduleUseCase(
private val queryUserPort: QueryUserPort,
private val scheduleQueryUserPort: ScheduleQueryUserPort,
private val querySchedulePort: QuerySchedulePort,
private val commandSchedulePort: CommandSchedulePort,
private val scheduleSecurityPort: ScheduleSecurityPort
Expand All @@ -30,7 +30,7 @@ class ChangeSpotScheduleUseCase(
fun execute(request: ChangeSpotScheduleRequest) {
val currentUserId = scheduleSecurityPort.getCurrentUserId()

val user = queryUserPort.queryUserById(currentUserId)
val user = scheduleQueryUserPort.queryUserById(currentUserId)
?: throw UserNotFoundException.EXCEPTION

val schedule = querySchedulePort.queryScheduleById(request.scheduleId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ import team.comit.simtong.domain.schedule.model.Schedule
import team.comit.simtong.domain.schedule.model.Scope
import team.comit.simtong.domain.schedule.spi.CommandSchedulePort
import team.comit.simtong.domain.schedule.spi.QuerySchedulePort
import team.comit.simtong.domain.schedule.spi.ScheduleQueryUserPort
import team.comit.simtong.domain.schedule.spi.ScheduleSecurityPort
import team.comit.simtong.domain.user.exception.NotEnoughPermissionException
import team.comit.simtong.domain.user.exception.UserNotFoundException
import team.comit.simtong.domain.user.model.Authority
import team.comit.simtong.domain.user.model.User
import team.comit.simtong.domain.user.spi.QueryUserPort
import java.time.LocalDate
import java.util.UUID

@ExtendWith(SpringExtension::class)
class ChangeSpotScheduleUseCaseTests {

@MockBean
private lateinit var queryUserPort: QueryUserPort
private lateinit var scheduleQueryUserPort: ScheduleQueryUserPort

@MockBean
private lateinit var querySchedulePort: QuerySchedulePort
Expand Down Expand Up @@ -71,7 +71,7 @@ class ChangeSpotScheduleUseCaseTests {
@BeforeEach
fun setUp() {
changeSpotScheduleUseCase = ChangeSpotScheduleUseCase(
queryUserPort = queryUserPort,
scheduleQueryUserPort = scheduleQueryUserPort,
querySchedulePort = querySchedulePort,
commandSchedulePort = commandSchedulePort,
scheduleSecurityPort = scheduleSecurityPort
Expand All @@ -97,7 +97,7 @@ class ChangeSpotScheduleUseCaseTests {
given(scheduleSecurityPort.getCurrentUserId())
.willReturn(userId)

given(queryUserPort.queryUserById(userId))
given(scheduleQueryUserPort.queryUserById(userId))
.willReturn(userStub)

given(querySchedulePort.queryScheduleById(requestStub.scheduleId))
Expand Down Expand Up @@ -128,7 +128,7 @@ class ChangeSpotScheduleUseCaseTests {
given(scheduleSecurityPort.getCurrentUserId())
.willReturn(userId)

given(queryUserPort.queryUserById(userId))
given(scheduleQueryUserPort.queryUserById(userId))
.willReturn(userStub)

given(querySchedulePort.queryScheduleById(requestStub.scheduleId))
Expand Down Expand Up @@ -159,7 +159,7 @@ class ChangeSpotScheduleUseCaseTests {
given(scheduleSecurityPort.getCurrentUserId())
.willReturn(userId)

given(queryUserPort.queryUserById(userId))
given(scheduleQueryUserPort.queryUserById(userId))
.willReturn(userStub)

given(querySchedulePort.queryScheduleById(requestStub.scheduleId))
Expand Down Expand Up @@ -190,7 +190,7 @@ class ChangeSpotScheduleUseCaseTests {
given(scheduleSecurityPort.getCurrentUserId())
.willReturn(userId)

given(queryUserPort.queryUserById(userId))
given(scheduleQueryUserPort.queryUserById(userId))
.willReturn(userStub)

given(querySchedulePort.queryScheduleById(requestStub.scheduleId))
Expand All @@ -208,7 +208,7 @@ class ChangeSpotScheduleUseCaseTests {
given(scheduleSecurityPort.getCurrentUserId())
.willReturn(userId)

given(queryUserPort.queryUserById(userId))
given(scheduleQueryUserPort.queryUserById(userId))
.willReturn(null)

// when & then
Expand Down

0 comments on commit 7e7306c

Please sign in to comment.