From 1c01374fcfc7c5de092f8d0cb4a390aa626af8e5 Mon Sep 17 00:00:00 2001 From: Jihun-Hwang Date: Mon, 15 Jul 2024 20:10:44 +0900 Subject: [PATCH] =?UTF-8?q?test:=20kotest=EB=A5=BC=20=ED=99=9C=EC=9A=A9?= =?UTF-8?q?=ED=95=9C=20=EB=8B=A8=EC=9C=84=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../usecase/BrowseProblemsUseCaseTest.kt | 58 +++--- .../usecase/CheckProblemUseCaseTest.kt | 101 +++++---- .../problem/usecase/ReadProblemUseCaseTest.kt | 82 ++++---- .../usecase/SubscribeWorkbookUseCaseTest.kt | 192 +++++++++--------- 4 files changed, 215 insertions(+), 218 deletions(-) diff --git a/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCaseTest.kt index d177ac47b..ee581b60c 100644 --- a/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCaseTest.kt @@ -3,46 +3,44 @@ package com.few.api.domain.problem.usecase import com.few.api.domain.problem.usecase.dto.BrowseProblemsUseCaseIn import com.few.api.repo.dao.problem.ProblemDao import com.few.api.repo.dao.problem.record.ProblemIdsRecord +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.core.spec.style.BehaviorSpec import io.mockk.every -import io.mockk.junit5.MockKExtension import io.mockk.mockk import io.mockk.verify -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith +class BrowseProblemsUseCaseTest : BehaviorSpec({ -@ExtendWith(MockKExtension::class) -class BrowseProblemsUseCaseTest { + lateinit var problemDao: ProblemDao + lateinit var useCase: BrowseProblemsUseCase + lateinit var useCaseIn: BrowseProblemsUseCaseIn - val problemDao: ProblemDao = mockk() + given("특정 아티클에 대한") { + beforeContainer { + problemDao = mockk() + useCase = BrowseProblemsUseCase(problemDao) + useCaseIn = BrowseProblemsUseCaseIn(articleId = 1L) + } - val useCase = BrowseProblemsUseCase(problemDao) + `when`("문제가 존재할 경우") { + val problemIdsRecord = ProblemIdsRecord(listOf(1, 2, 3)) + every { problemDao.selectProblemsByArticleId(any()) } returns problemIdsRecord - @Test - fun `특정 아티클에 문제가 존재할 경우 문제번호가 정상적으로 조회된다`() { - // given - val useCaseIn = BrowseProblemsUseCaseIn(articleId = 1L) - val problemIdsRecord = ProblemIdsRecord(listOf(1, 2, 3)) + then("문제번호가 정상적으로 조회된다") { + useCase.execute(useCaseIn) - every { problemDao.selectProblemsByArticleId(any()) } returns problemIdsRecord + verify(exactly = 1) { problemDao.selectProblemsByArticleId(any()) } + } + } - // when - useCase.execute(useCaseIn) + `when`("문제가 존재하지 않을 경우") { + every { problemDao.selectProblemsByArticleId(any()) } returns null - // then - verify(exactly = 1) { problemDao.selectProblemsByArticleId(any()) } - } - - @Test - fun `특정 아티클에 문제가 존재하지 않을 경우 예외가 발생한다`() { - // given - val useCaseIn = BrowseProblemsUseCaseIn(articleId = 1L) - - every { problemDao.selectProblemsByArticleId(any()) } returns null + then("예외가 발생한다") { + shouldThrow { useCase.execute(useCaseIn) } - // when / then - Assertions.assertThrows(Exception::class.java) { useCase.execute(useCaseIn) } - verify(exactly = 1) { problemDao.selectProblemsByArticleId(any()) } + verify(exactly = 1) { problemDao.selectProblemsByArticleId(any()) } + } + } } -} \ No newline at end of file +}) \ No newline at end of file diff --git a/api/src/test/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCaseTest.kt index c2b54db58..d1dfd65ae 100644 --- a/api/src/test/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/problem/usecase/CheckProblemUseCaseTest.kt @@ -4,73 +4,72 @@ import com.few.api.domain.problem.usecase.dto.CheckProblemUseCaseIn import com.few.api.repo.dao.problem.ProblemDao import com.few.api.repo.dao.problem.SubmitHistoryDao import com.few.api.repo.dao.problem.record.SelectProblemAnswerRecord +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.core.spec.style.BehaviorSpec +import io.kotest.matchers.shouldBe import io.mockk.every -import io.mockk.junit5.MockKExtension import io.mockk.mockk import io.mockk.verify -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(MockKExtension::class) -class CheckProblemUseCaseTest { +class CheckProblemUseCaseTest : BehaviorSpec({ - val problemDao: ProblemDao = mockk() + lateinit var problemDao: ProblemDao + lateinit var submitHistoryDao: SubmitHistoryDao + lateinit var useCase: CheckProblemUseCase - val submitHistoryDao: SubmitHistoryDao = mockk() + given("문제 정답 확인 요청이 온 상황에서") { - val useCase = CheckProblemUseCase(problemDao, submitHistoryDao) + beforeContainer { + problemDao = mockk() + submitHistoryDao = mockk() + useCase = CheckProblemUseCase(problemDao, submitHistoryDao) + } - @Test - fun `제출 값과 문제 정답이 같다`() { - // given - val submissionVal = "1" - val answer = submissionVal - val useCaseIn = CheckProblemUseCaseIn(problemId = 1L, sub = submissionVal) - val answerRecord = SelectProblemAnswerRecord(id = 1L, answer = answer, explanation = "해설입니다.") + `when`("제출 값과 문제 정답이 같을 경우") { + val submissionVal = "1" + val answer = submissionVal + val useCaseIn = CheckProblemUseCaseIn(problemId = 1L, sub = submissionVal) + val answerRecord = SelectProblemAnswerRecord(id = 1L, answer = answer, explanation = "해설입니다.") - every { problemDao.selectProblemAnswer(any()) } returns answerRecord - every { submitHistoryDao.insertSubmitHistory(any()) } returns 1L + every { problemDao.selectProblemAnswer(any()) } returns answerRecord + every { submitHistoryDao.insertSubmitHistory(any()) } returns 1L - // when - val useCaseOut = useCase.execute(useCaseIn) + then("문제가 정답처리 된다") { + val useCaseOut = useCase.execute(useCaseIn) - // then - assert(useCaseOut.isSolved) - verify(exactly = 1) { problemDao.selectProblemAnswer(any()) } - verify(exactly = 1) { submitHistoryDao.insertSubmitHistory(any()) } - } - - @Test - fun `제출 값과 문제 정답이 다르다`() { - // given - val submissionVal = "1" - val answer = "2" - val useCaseIn = CheckProblemUseCaseIn(problemId = 1L, sub = submissionVal) - val answerRecord = SelectProblemAnswerRecord(id = 1L, answer = answer, explanation = "해설입니다.") + useCaseOut.isSolved shouldBe true + verify(exactly = 1) { problemDao.selectProblemAnswer(any()) } + verify(exactly = 1) { submitHistoryDao.insertSubmitHistory(any()) } + } + } - every { problemDao.selectProblemAnswer(any()) } returns answerRecord - every { submitHistoryDao.insertSubmitHistory(any()) } returns 1L + `when`("제출 값과 문제 정답이 다를 경우") { + val submissionVal = "1" + val answer = "2" + val useCaseIn = CheckProblemUseCaseIn(problemId = 1L, sub = submissionVal) + val answerRecord = SelectProblemAnswerRecord(id = 1L, answer = answer, explanation = "해설입니다.") - // when - val useCaseOut = useCase.execute(useCaseIn) + every { problemDao.selectProblemAnswer(any()) } returns answerRecord + every { submitHistoryDao.insertSubmitHistory(any()) } returns 1L - // then - assert(!useCaseOut.isSolved) - verify(exactly = 1) { problemDao.selectProblemAnswer(any()) } - verify(exactly = 1) { submitHistoryDao.insertSubmitHistory(any()) } - } + then("문제가 오답처리 된다") { + val useCaseOut = useCase.execute(useCaseIn) - @Test - fun `존재하지 않는 문제일 경우 예외가 발생한다`() { - // given - val useCaseIn = CheckProblemUseCaseIn(problemId = 1L, sub = "1") + useCaseOut.isSolved shouldBe false + verify(exactly = 1) { problemDao.selectProblemAnswer(any()) } + verify(exactly = 1) { submitHistoryDao.insertSubmitHistory(any()) } + } + } - every { problemDao.selectProblemAnswer(any()) } returns null + `when`("존재하지 않는 문제일 경우") { + val useCaseIn = CheckProblemUseCaseIn(problemId = 1L, sub = "1") - // when, then - Assertions.assertThrows(Exception::class.java) { useCase.execute(useCaseIn) } + every { problemDao.selectProblemAnswer(any()) } returns null - verify(exactly = 1) { problemDao.selectProblemAnswer(any()) } + then("예외가 발생한다") { + shouldThrow { useCase.execute(useCaseIn) } + verify(exactly = 1) { problemDao.selectProblemAnswer(any()) } + } + } } -} \ No newline at end of file +}) \ No newline at end of file diff --git a/api/src/test/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCaseTest.kt index ce6f336e6..d9d66ccda 100644 --- a/api/src/test/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/problem/usecase/ReadProblemUseCaseTest.kt @@ -6,57 +6,55 @@ import com.few.api.repo.dao.problem.record.SelectProblemRecord import com.few.api.repo.dao.problem.support.Content import com.few.api.repo.dao.problem.support.Contents import com.few.api.repo.dao.problem.support.ContentsJsonMapper +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.core.spec.style.BehaviorSpec import io.mockk.every -import io.mockk.junit5.MockKExtension import io.mockk.mockk import io.mockk.verify -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(MockKExtension::class) -class ReadProblemUseCaseTest { - - val problemDao: ProblemDao = mockk() - - val contentsJsonMapper: ContentsJsonMapper = mockk() - - val useCase = ReadProblemUseCase(problemDao, contentsJsonMapper) - - @Test - fun `문제ID로 문제를 조회힌다`() { - // given - val useCaseIn = ReadProblemUseCaseIn(problemId = 1L) - val problemRecord = SelectProblemRecord(id = 1L, title = "title", contents = "{}") - val contents = Contents( - listOf( - Content(number = 1, content = "{}"), - Content(number = 2, content = "{}") +class ReadProblemUseCaseTest : BehaviorSpec({ + + lateinit var problemDao: ProblemDao + lateinit var contentsJsonMapper: ContentsJsonMapper + lateinit var useCase: ReadProblemUseCase + lateinit var useCaseIn: ReadProblemUseCaseIn + + given("문제를 조회할 상황에서") { + beforeContainer { + problemDao = mockk() + contentsJsonMapper = mockk() + useCase = ReadProblemUseCase(problemDao, contentsJsonMapper) + useCaseIn = ReadProblemUseCaseIn(problemId = 1L) + } + + `when`("문제가 존재할 경우") { + val problemRecord = SelectProblemRecord(id = 1L, title = "title", contents = "{}") + val contents = Contents( + listOf( + Content(number = 1, content = "{}"), + Content(number = 2, content = "{}") + ) ) - ) - - every { problemDao.selectProblemContents(any()) } returns problemRecord - every { contentsJsonMapper.toObject(any()) } returns contents - // when - useCase.execute(useCaseIn) + every { problemDao.selectProblemContents(any()) } returns problemRecord + every { contentsJsonMapper.toObject(any()) } returns contents - // then - verify(exactly = 1) { problemDao.selectProblemContents(any()) } - verify(exactly = 1) { contentsJsonMapper.toObject(any()) } - } + then("정상적으로 실행되어야 한다") { + useCase.execute(useCaseIn) - @Test - fun `문제가 존재하지 않을 경우 예외가 발생한다`() { - // given - val useCaseIn = ReadProblemUseCaseIn(problemId = 1L) + verify(exactly = 1) { problemDao.selectProblemContents(any()) } + verify(exactly = 1) { contentsJsonMapper.toObject(any()) } + } + } - every { problemDao.selectProblemContents(any()) } returns null + `when`("문제가 존재하지 않을 경우") { + every { problemDao.selectProblemContents(any()) } returns null - // when, then - Assertions.assertThrows(Exception::class.java) { useCase.execute(useCaseIn) } + then("예외가 발생해야 한다") { + shouldThrow { useCase.execute(useCaseIn) } - verify(exactly = 1) { problemDao.selectProblemContents(any()) } + verify(exactly = 1) { problemDao.selectProblemContents(any()) } + } + } } -} \ No newline at end of file +}) \ No newline at end of file diff --git a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCaseTest.kt b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCaseTest.kt index 6a8bd2057..d17870528 100644 --- a/api/src/test/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCaseTest.kt +++ b/api/src/test/kotlin/com/few/api/domain/subscription/usecase/SubscribeWorkbookUseCaseTest.kt @@ -6,110 +6,112 @@ import com.few.api.domain.subscription.service.dto.MemberIdOutDto import com.few.api.domain.subscription.usecase.dto.SubscribeWorkbookUseCaseIn import com.few.api.repo.dao.subscription.SubscriptionDao import com.few.api.repo.dao.subscription.record.WorkbookSubscriptionStatus -import io.mockk.* -import io.mockk.junit5.MockKExtension -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.Test - -import org.junit.jupiter.api.extension.ExtendWith +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.core.spec.style.BehaviorSpec +import io.mockk.every +import io.mockk.mockk +import io.mockk.verify +import io.mockk.just +import io.mockk.Runs import org.springframework.context.ApplicationEventPublisher -@ExtendWith(MockKExtension::class) -class SubscribeWorkbookUseCaseTest { - val subscriptionDao = mockk() - - val memberService = mockk() - - val applicationEventPublisher = mockk() +class SubscribeWorkbookUseCaseTest : BehaviorSpec({ - val useCase = SubscribeWorkbookUseCase(subscriptionDao, memberService, applicationEventPublisher) + lateinit var subscriptionDao: SubscriptionDao + lateinit var memberService: MemberService + lateinit var applicationEventPublisher: ApplicationEventPublisher + lateinit var useCase: SubscribeWorkbookUseCase - @Test - fun `subscriptionStatus가 null일 경우 신규 구독을 추가한다`() { - // given - val workbookId = 1L - val useCaseIn = SubscribeWorkbookUseCaseIn(workbookId = workbookId, email = "test@test.com") - val serviceOutDto = MemberIdOutDto(memberId = 1L) - val event = WorkbookSubscriptionEvent(workbookId) + given("구독 요청이 온 상황에서") { - every { memberService.readMemberId(any()) } returns null - every { memberService.insertMember(any()) } returns serviceOutDto - every { subscriptionDao.selectTopWorkbookSubscriptionStatus(any()) } returns null - every { subscriptionDao.insertWorkbookSubscription(any()) } just Runs - every { applicationEventPublisher.publishEvent(event) } answers { - println("Mocking applicationEventPublisher.publishEvent(any()) was called") + beforeContainer { + subscriptionDao = mockk() + memberService = mockk() + applicationEventPublisher = mockk() + useCase = SubscribeWorkbookUseCase(subscriptionDao, memberService, applicationEventPublisher) } - // when - useCase.execute(useCaseIn) - - // then - verify(exactly = 1) { memberService.insertMember(any()) } - verify(exactly = 1) { subscriptionDao.insertWorkbookSubscription(any()) } - verify(exactly = 0) { subscriptionDao.countWorkbookMappedArticles(any()) } - verify(exactly = 0) { subscriptionDao.reSubscribeWorkbookSubscription(any()) } - verify(exactly = 1) { applicationEventPublisher.publishEvent(event) } - } - - @Test - fun `구독을 취소한 경우 재구독한다`() { - // given - val workbookId = 1L - val useCaseIn = SubscribeWorkbookUseCaseIn(workbookId = workbookId, email = "test@test.com") - val day = 2 // 현재 유저가 구독 취소 전 마지막으로 읽은 day 값 - val lastDay = 3 // 워크북 고유 정보 (워크북이 구성된 day 값) - val serviceOutDto = MemberIdOutDto(memberId = 1L) - val subscriptionStatusRecord = WorkbookSubscriptionStatus(workbookId = workbookId, isActiveSub = false, day) - val event = WorkbookSubscriptionEvent(workbookId) - - every { memberService.readMemberId(any()) } returns null - every { memberService.insertMember(any()) } returns serviceOutDto - every { subscriptionDao.selectTopWorkbookSubscriptionStatus(any()) } returns subscriptionStatusRecord - every { subscriptionDao.countWorkbookMappedArticles(any()) } returns lastDay - every { subscriptionDao.reSubscribeWorkbookSubscription(any()) } just Runs - every { applicationEventPublisher.publishEvent(event) } answers { - println("Mocking applicationEventPublisher.publishEvent(any()) was called") + `when`("subscriptionStatus가 null일 경우") { + val workbookId = 1L + val useCaseIn = SubscribeWorkbookUseCaseIn(workbookId = workbookId, email = "test@test.com") + val serviceOutDto = MemberIdOutDto(memberId = 1L) + val event = WorkbookSubscriptionEvent(workbookId) + + every { memberService.readMemberId(any()) } returns null + every { memberService.insertMember(any()) } returns serviceOutDto + every { subscriptionDao.selectTopWorkbookSubscriptionStatus(any()) } returns null + every { subscriptionDao.insertWorkbookSubscription(any()) } just Runs + every { applicationEventPublisher.publishEvent(event) } answers { + println("Mocking applicationEventPublisher.publishEvent(any()) was called") + } + + then("신규 구독을 추가한다") { + useCase.execute(useCaseIn) + + verify(exactly = 1) { memberService.insertMember(any()) } + verify(exactly = 1) { subscriptionDao.insertWorkbookSubscription(any()) } + verify(exactly = 0) { subscriptionDao.countWorkbookMappedArticles(any()) } + verify(exactly = 0) { subscriptionDao.reSubscribeWorkbookSubscription(any()) } + verify(exactly = 1) { applicationEventPublisher.publishEvent(event) } + } } - // when - useCase.execute(useCaseIn) - - // then - verify(exactly = 1) { memberService.insertMember(any()) } - verify(exactly = 0) { subscriptionDao.insertWorkbookSubscription(any()) } - verify(exactly = 1) { subscriptionDao.countWorkbookMappedArticles(any()) } - verify(exactly = 1) { subscriptionDao.reSubscribeWorkbookSubscription(any()) } - verify(exactly = 1) { applicationEventPublisher.publishEvent(event) } - } - - @Test - fun `이미 구독하고 있을 경우 예외가 발생한다`() { - // given - val workbookId = 1L - val useCaseIn = SubscribeWorkbookUseCaseIn(workbookId = workbookId, email = "test@test.com") - val day = 2 // 현재 유저가 구독 취소 전 마지막으로 읽은 day 값 - val lastDay = 3 // 워크북 고유 정보 (워크북이 구성된 day 값) - val serviceOutDto = MemberIdOutDto(memberId = 1L) - val subscriptionStatusRecord = WorkbookSubscriptionStatus(workbookId = workbookId, isActiveSub = true, day) - val event = WorkbookSubscriptionEvent(workbookId) - - every { memberService.readMemberId(any()) } returns null - every { memberService.insertMember(any()) } returns serviceOutDto - every { subscriptionDao.selectTopWorkbookSubscriptionStatus(any()) } returns subscriptionStatusRecord - every { subscriptionDao.countWorkbookMappedArticles(any()) } returns lastDay - every { subscriptionDao.reSubscribeWorkbookSubscription(any()) } just Runs - every { applicationEventPublisher.publishEvent(event) } answers { - println("Mocking applicationEventPublisher.publishEvent(any()) was called") + `when`("구독을 취소한 경우") { + val workbookId = 1L + val useCaseIn = SubscribeWorkbookUseCaseIn(workbookId = workbookId, email = "test@test.com") + val day = 2 + val lastDay = 3 + val serviceOutDto = MemberIdOutDto(memberId = 1L) + val subscriptionStatusRecord = WorkbookSubscriptionStatus(workbookId = workbookId, isActiveSub = false, day) + val event = WorkbookSubscriptionEvent(workbookId) + + every { memberService.readMemberId(any()) } returns null + every { memberService.insertMember(any()) } returns serviceOutDto + every { subscriptionDao.selectTopWorkbookSubscriptionStatus(any()) } returns subscriptionStatusRecord + every { subscriptionDao.countWorkbookMappedArticles(any()) } returns lastDay + every { subscriptionDao.reSubscribeWorkbookSubscription(any()) } just Runs + every { applicationEventPublisher.publishEvent(event) } answers { + println("Mocking applicationEventPublisher.publishEvent(any()) was called") + } + + then("재구독한다") { + useCase.execute(useCaseIn) + + verify(exactly = 1) { memberService.insertMember(any()) } + verify(exactly = 0) { subscriptionDao.insertWorkbookSubscription(any()) } + verify(exactly = 1) { subscriptionDao.countWorkbookMappedArticles(any()) } + verify(exactly = 1) { subscriptionDao.reSubscribeWorkbookSubscription(any()) } + verify(exactly = 1) { applicationEventPublisher.publishEvent(event) } + } } - // when - Assertions.assertThrows(Exception::class.java) { useCase.execute(useCaseIn) } - - // then - verify(exactly = 1) { memberService.insertMember(any()) } - verify(exactly = 0) { subscriptionDao.insertWorkbookSubscription(any()) } - verify(exactly = 0) { subscriptionDao.countWorkbookMappedArticles(any()) } - verify(exactly = 0) { subscriptionDao.reSubscribeWorkbookSubscription(any()) } - verify(exactly = 0) { applicationEventPublisher.publishEvent(event) } + `when`("이미 구독하고 있을 경우") { + val workbookId = 1L + val useCaseIn = SubscribeWorkbookUseCaseIn(workbookId = workbookId, email = "test@test.com") + val day = 2 + val lastDay = 3 + val serviceOutDto = MemberIdOutDto(memberId = 1L) + val subscriptionStatusRecord = WorkbookSubscriptionStatus(workbookId = workbookId, isActiveSub = true, day) + val event = WorkbookSubscriptionEvent(workbookId) + + every { memberService.readMemberId(any()) } returns null + every { memberService.insertMember(any()) } returns serviceOutDto + every { subscriptionDao.selectTopWorkbookSubscriptionStatus(any()) } returns subscriptionStatusRecord + every { subscriptionDao.countWorkbookMappedArticles(any()) } returns lastDay + every { subscriptionDao.reSubscribeWorkbookSubscription(any()) } just Runs + every { applicationEventPublisher.publishEvent(event) } answers { + println("Mocking applicationEventPublisher.publishEvent(any()) was called") + } + + then("예외가 발생한다") { + shouldThrow { useCase.execute(useCaseIn) } + + verify(exactly = 1) { memberService.insertMember(any()) } + verify(exactly = 0) { subscriptionDao.insertWorkbookSubscription(any()) } + verify(exactly = 0) { subscriptionDao.countWorkbookMappedArticles(any()) } + verify(exactly = 0) { subscriptionDao.reSubscribeWorkbookSubscription(any()) } + verify(exactly = 0) { applicationEventPublisher.publishEvent(event) } + } + } } -} \ No newline at end of file +}) \ No newline at end of file