-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2b7f37
commit ba64ffb
Showing
6 changed files
with
86 additions
and
8 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
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ import org.junit.jupiter.api.assertDoesNotThrow | |
import org.junit.jupiter.api.assertThrows | ||
import org.mockito.kotlin.given | ||
import org.springframework.boot.test.mock.mockito.MockBean | ||
import team.comit.simtong.domain.schedule.exception.DifferentScopeException | ||
import team.comit.simtong.domain.schedule.exception.ScheduleNotFoundException | ||
import team.comit.simtong.domain.schedule.model.Schedule | ||
import team.comit.simtong.domain.schedule.model.Scope | ||
|
@@ -160,6 +161,48 @@ class RemoveSpotScheduleUseCaseTests { | |
} | ||
} | ||
|
||
@Test | ||
fun `일정 범위가 다름`() { | ||
// given | ||
val userStub = User( | ||
id = userId, | ||
nickname = "test nickname", | ||
name = "test name", | ||
email = "[email protected]", | ||
password = "test password", | ||
employeeNumber = 1234567890, | ||
authority = Authority.ROLE_SUPER, | ||
spotId = UUID.randomUUID(), | ||
teamId = UUID.randomUUID(), | ||
profileImagePath = "test profile image" | ||
) | ||
|
||
val scheduleStub = Schedule( | ||
id = scheduleId, | ||
userId = userId, | ||
spotId = spotId, | ||
title = "test title", | ||
scope = Scope.INDIVIDUAL, | ||
startAt = LocalDate.now(), | ||
endAt = LocalDate.now(), | ||
alarmTime = Schedule.DEFAULT_ALARM_TIME | ||
) | ||
|
||
given(securityPort.getCurrentUserId()) | ||
.willReturn(userId) | ||
|
||
given(queryUserPort.queryUserById(userId)) | ||
.willReturn(userStub) | ||
|
||
given(querySchedulePort.queryScheduleById(scheduleId)) | ||
.willReturn(scheduleStub) | ||
|
||
// when & then | ||
assertThrows<DifferentScopeException> { | ||
removeSpotScheduleUseCase.execute(scheduleId) | ||
} | ||
} | ||
|
||
@Test | ||
fun `일정을 찾을 수 없음`() { | ||
// given | ||
|
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
20 changes: 20 additions & 0 deletions
20
...n/src/main/kotlin/team/comit/simtong/domain/schedule/exception/DifferentScopeException.kt
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,20 @@ | ||
package team.comit.simtong.domain.schedule.exception | ||
|
||
import team.comit.simtong.domain.schedule.error.ScheduleErrorCode | ||
import team.comit.simtong.global.error.BusinessException | ||
|
||
/** | ||
* | ||
* Different Schedule Scope Error를 발생시키는 DifferentScopeException | ||
* | ||
* @author kimbeomjin | ||
* @date 2022/12/03 | ||
* @version 1.0.0 | ||
**/ | ||
class DifferentScopeException private constructor(): BusinessException(ScheduleErrorCode.DIFFERENT_SCHEDULE_SCOPE) { | ||
|
||
companion object { | ||
@JvmField | ||
val EXCEPTION = DifferentScopeException() | ||
} | ||
} |