Closed veluxer62 closed 3 years ago
ULID 라이브러리
https://github.com/JonasSchubert/kULID 이걸 쓰기로함. 문자열 순서도 보장해주기 때문에 유용함. UUID 지원만 해주면 좋을텐데
flyway 마이그레이션 시 환경별로 분리할 수 있네
JAVA 16에서 mockkStatic
을 이용하여 ZonedDateTime.now()를 고정하여 테스트를 수행하면 오류가 발생한다.
mockk API에서 최근에 이슈가 제기된것 같고 이슈 확인중이라고 한다.
test logger plugin이 있네!!!
CI가 돌다가 아래와 같이 에러가 나는 경우가 있는데 찾아보니 OOM 이슈인거 같다.
이런경우에 --no-daemon
옵션을 주면 된다
https://stackoverflow.com/questions/38967991/why-are-my-gradle-builds-dying-with-exit-code-137
Mockk 라이브러리에서 JPA repository의 save 함수를 이용하여 테스트를 할때 오류가 발생한다.
test("안심번호 연결 함수는 전화번호가 주어지면 안심번호를 생성하고 연결이력을 저장한 후 안심번호를 반환한다.") {
val originNumber = "01012341234"
val safetyNumber = "050437973400"
every { generator.generate(originNumber) } returns safetyNumber
val actual = sut.linkSafetyNumber(originNumber)
actual shouldBe safetyNumber
verify {
val entityMatch = match<SafetyNumberLinkageHistory> {
it.originNumber == originNumber &&
it.safetyNumber == safetyNumber &&
it.status == ASSIGNED
}
repository.save(entityMatch)
}
}
class java.lang.Object cannot be cast to class com.spoqa.safetynumberservice.domain.SafetyNumberLinkageHistory (java.lang.Object is in module java.base of loader 'bootstrap'; com.spoqa.safetynumberservice.domain.SafetyNumberLinkageHistory is in unnamed module of loader 'app')
java.lang.ClassCastException: class java.lang.Object cannot be cast to class com.spoqa.safetynumberservice.domain.SafetyNumberLinkageHistory (java.lang.Object is in module java.base of loader 'bootstrap'; com.spoqa.safetynumberservice.domain.SafetyNumberLinkageHistory is in unnamed module of loader 'app')
at com.spoqa.safetynumberservice.domain.SafetyNumberLinkageHistoryRepository$Subclass5.save(Unknown Source)
at com.spoqa.safetynumberservice.domain.SafetyNumberLinkageHistoryRepository$Subclass5.save(Unknown Source)
at com.spoqa.safetynumberservice.domain.SimpleSafetyNumberLinkageService.linkSafetyNumber(SafetyNumberLinkageService.kt:21)
at com.spoqa.safetynumberservice.domain.SimpleSafetyNumberLinkageServiceTest$1.invokeSuspend(SimpleSafetyNumberLinkageServiceTest.kt:24)
at com.spoqa.safetynumberservice.domain.SimpleSafetyNumberLinkageServiceTest$1.invoke(SimpleSafetyNumberLinkageServiceTest.kt)
at com.spoqa.safetynumberservice.domain.SimpleSafetyNumberLinkageServiceTest$1.invoke(SimpleSafetyNumberLinkageServiceTest.kt)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2$1.invokeSuspend(executions.kt:13)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2$1.invoke(executions.kt)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2$1.invoke(executions.kt)
at io.kotest.core.internal.ExecutionsKt.wrapTestWithGlobalAssert(executions.kt:39)
at io.kotest.core.internal.ExecutionsKt.access$wrapTestWithGlobalAssert(executions.kt:1)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2.invokeSuspend(executions.kt:12)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2.invoke(executions.kt)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2.invoke(executions.kt)
at io.kotest.core.internal.ExecutionsKt$wrapTestWithAssertionModeCheck$2.invokeSuspend(executions.kt:25)
at io.kotest.core.internal.ExecutionsKt$wrapTestWithAssertionModeCheck$2.invoke(executions.kt)
at io.kotest.core.internal.ExecutionsKt$wrapTestWithAssertionModeCheck$2.invoke(executions.kt)
at io.kotest.core.internal.AssertionsCheckKt.executeWithAssertionsCheck(assertionsCheck.kt:25)
at io.kotest.core.internal.ExecutionsKt.wrapTestWithAssertionModeCheck(executions.kt:24)
at io.kotest.core.internal.ExecutionsKt.executeWithBehaviours(executions.kt:11)
at io.kotest.core.internal.TestCaseExecutor$executeInScope$2.invokeSuspend(TestCaseExecutor.kt:268)
at io.kotest.core.internal.TestCaseExecutor$executeInScope$2.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$executeInScope$2.invoke(TestCaseExecutor.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
at io.kotest.core.internal.TestCaseExecutor.executeInScope(TestCaseExecutor.kt:262)
at io.kotest.core.internal.TestCaseExecutor.access$executeInScope(TestCaseExecutor.kt:57)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3$1$1.invokeSuspend(TestCaseExecutor.kt:234)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3$1$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3$1$1.invoke(TestCaseExecutor.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturnIgnoreTimeout(Undispatched.kt:100)
at kotlinx.coroutines.TimeoutKt.setupTimeout(Timeout.kt:148)
at kotlinx.coroutines.TimeoutKt.withTimeout(Timeout.kt:44)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3$1.invokeSuspend(TestCaseExecutor.kt:233)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3$1.invoke(TestCaseExecutor.kt)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$4.invokeSuspend(ExecutorExecutionContext.kt:77)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$4.invoke(ExecutorExecutionContext.kt)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$4.invoke(ExecutorExecutionContext.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:165)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
at io.kotest.engine.ExecutorExecutionContext.executeWithTimeoutInterruption(ExecutorExecutionContext.kt:75)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3.invokeSuspend(TestCaseExecutor.kt:232)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3.invoke(TestCaseExecutor.kt)
at io.kotest.mpp.ReplayKt.replay(replay.kt:18)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1.invokeSuspend(TestCaseExecutor.kt:227)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1.invoke(TestCaseExecutor.kt)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$4.invokeSuspend(ExecutorExecutionContext.kt:77)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$4.invoke(ExecutorExecutionContext.kt)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$4.invoke(ExecutorExecutionContext.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:165)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
at io.kotest.engine.ExecutorExecutionContext.executeWithTimeoutInterruption(ExecutorExecutionContext.kt:75)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1.invokeSuspend(TestCaseExecutor.kt:220)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1.invoke(TestCaseExecutor.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturnIgnoreTimeout(Undispatched.kt:100)
at kotlinx.coroutines.TimeoutKt.setupTimeout(Timeout.kt:148)
at kotlinx.coroutines.TimeoutKt.withTimeout(Timeout.kt:44)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4.invokeSuspend(TestCaseExecutor.kt:219)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4.invoke(TestCaseExecutor.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.SupervisorKt.supervisorScope(Supervisor.kt:61)
at io.kotest.core.internal.TestCaseExecutor.executeAndWait(TestCaseExecutor.kt:215)
at io.kotest.core.internal.TestCaseExecutor.invokeTestCase(TestCaseExecutor.kt:184)
at io.kotest.core.internal.TestCaseExecutor.executeActiveTest(TestCaseExecutor.kt:153)
at io.kotest.core.internal.TestCaseExecutor.access$executeActiveTest(TestCaseExecutor.kt:57)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1$1.invokeSuspend(TestCaseExecutor.kt:89)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor.executeIfEnabled(TestCaseExecutor.kt:117)
at io.kotest.core.internal.TestCaseExecutor.access$executeIfEnabled(TestCaseExecutor.kt:57)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1.invokeSuspend(TestCaseExecutor.kt:89)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor.intercept(TestCaseExecutor.kt:103)
at io.kotest.core.internal.TestCaseExecutor.execute(TestCaseExecutor.kt:69)
at io.kotest.engine.spec.runners.SingleInstanceSpecRunner.runTest(SingleInstanceSpecRunner.kt:104)
at io.kotest.engine.spec.runners.SingleInstanceSpecRunner.access$runTest(SingleInstanceSpecRunner.kt:34)
at io.kotest.engine.spec.runners.SingleInstanceSpecRunner$execute$interceptAndRun$2$4.invokeSuspend(SingleInstanceSpecRunner.kt:57)
at io.kotest.engine.spec.runners.SingleInstanceSpecRunner$execute$interceptAndRun$2$4.invoke(SingleInstanceSpecRunner.kt)
at io.kotest.engine.spec.runners.SingleInstanceSpecRunner$execute$interceptAndRun$2$4.invoke(SingleInstanceSpecRunner.kt)
at io.kotest.engine.launchers.SequentialTestLauncher$launch$3$1$1.invokeSuspend(SequentialTestLauncher.kt:22)
(Coroutine boundary)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3$1$1.invokeSuspend(TestCaseExecutor.kt:234)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3$1.invokeSuspend(TestCaseExecutor.kt:233)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$4.invokeSuspend(ExecutorExecutionContext.kt:77)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3.invokeSuspend(TestCaseExecutor.kt:232)
at io.kotest.mpp.ReplayKt.replay(replay.kt:18)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1.invokeSuspend(TestCaseExecutor.kt:227)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$4.invokeSuspend(ExecutorExecutionContext.kt:77)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1.invokeSuspend(TestCaseExecutor.kt:220)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4.invokeSuspend(TestCaseExecutor.kt:219)
at io.kotest.core.internal.TestCaseExecutor.invokeTestCase(TestCaseExecutor.kt:184)
at io.kotest.core.internal.TestCaseExecutor.executeActiveTest(TestCaseExecutor.kt:153)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1$1.invokeSuspend(TestCaseExecutor.kt:89)
at io.kotest.core.internal.TestCaseExecutor.executeIfEnabled(TestCaseExecutor.kt:117)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1.invokeSuspend(TestCaseExecutor.kt:89)
at io.kotest.core.internal.TestCaseExecutor.execute(TestCaseExecutor.kt:69)
at io.kotest.engine.spec.runners.SingleInstanceSpecRunner.runTest(SingleInstanceSpecRunner.kt:104)
at io.kotest.engine.spec.runners.SingleInstanceSpecRunner$execute$interceptAndRun$2$4.invokeSuspend(SingleInstanceSpecRunner.kt:57)
at io.kotest.engine.launchers.SequentialTestLauncher$launch$3$1$1.invokeSuspend(SequentialTestLauncher.kt:22)
Caused by: java.lang.ClassCastException: class java.lang.Object cannot be cast to class com.spoqa.safetynumberservice.domain.SafetyNumberLinkageHistory (java.lang.Object is in module java.base of loader 'bootstrap'; com.spoqa.safetynumberservice.domain.SafetyNumberLinkageHistory is in unnamed module of loader 'app')
at com.spoqa.safetynumberservice.domain.SafetyNumberLinkageHistoryRepository$Subclass5.save(Unknown Source)
at com.spoqa.safetynumberservice.domain.SafetyNumberLinkageHistoryRepository$Subclass5.save(Unknown Source)
at com.spoqa.safetynumberservice.domain.SimpleSafetyNumberLinkageService.linkSafetyNumber(SafetyNumberLinkageService.kt:21)
at com.spoqa.safetynumberservice.domain.SimpleSafetyNumberLinkageServiceTest$1.invokeSuspend(SimpleSafetyNumberLinkageServiceTest.kt:24)
at com.spoqa.safetynumberservice.domain.SimpleSafetyNumberLinkageServiceTest$1.invoke(SimpleSafetyNumberLinkageServiceTest.kt)
at com.spoqa.safetynumberservice.domain.SimpleSafetyNumberLinkageServiceTest$1.invoke(SimpleSafetyNumberLinkageServiceTest.kt)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2$1.invokeSuspend(executions.kt:13)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2$1.invoke(executions.kt)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2$1.invoke(executions.kt)
at io.kotest.core.internal.ExecutionsKt.wrapTestWithGlobalAssert(executions.kt:39)
at io.kotest.core.internal.ExecutionsKt.access$wrapTestWithGlobalAssert(executions.kt:1)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2.invokeSuspend(executions.kt:12)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2.invoke(executions.kt)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2.invoke(executions.kt)
at io.kotest.core.internal.ExecutionsKt$wrapTestWithAssertionModeCheck$2.invokeSuspend(executions.kt:25)
at io.kotest.core.internal.ExecutionsKt$wrapTestWithAssertionModeCheck$2.invoke(executions.kt)
at io.kotest.core.internal.ExecutionsKt$wrapTestWithAssertionModeCheck$2.invoke(executions.kt)
at io.kotest.core.internal.AssertionsCheckKt.executeWithAssertionsCheck(assertionsCheck.kt:25)
at io.kotest.core.internal.ExecutionsKt.wrapTestWithAssertionModeCheck(executions.kt:24)
at io.kotest.core.internal.ExecutionsKt.executeWithBehaviours(executions.kt:11)
at io.kotest.core.internal.TestCaseExecutor$executeInScope$2.invokeSuspend(TestCaseExecutor.kt:268)
at io.kotest.core.internal.TestCaseExecutor$executeInScope$2.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$executeInScope$2.invoke(TestCaseExecutor.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
at io.kotest.core.internal.TestCaseExecutor.executeInScope(TestCaseExecutor.kt:262)
at io.kotest.core.internal.TestCaseExecutor.access$executeInScope(TestCaseExecutor.kt:57)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3$1$1.invokeSuspend(TestCaseExecutor.kt:234)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3$1$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3$1$1.invoke(TestCaseExecutor.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturnIgnoreTimeout(Undispatched.kt:100)
at kotlinx.coroutines.TimeoutKt.setupTimeout(Timeout.kt:148)
at kotlinx.coroutines.TimeoutKt.withTimeout(Timeout.kt:44)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3$1.invokeSuspend(TestCaseExecutor.kt:233)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3$1.invoke(TestCaseExecutor.kt)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$4.invokeSuspend(ExecutorExecutionContext.kt:77)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$4.invoke(ExecutorExecutionContext.kt)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$4.invoke(ExecutorExecutionContext.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:165)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
at io.kotest.engine.ExecutorExecutionContext.executeWithTimeoutInterruption(ExecutorExecutionContext.kt:75)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3.invokeSuspend(TestCaseExecutor.kt:232)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1$3.invoke(TestCaseExecutor.kt)
at io.kotest.mpp.ReplayKt.replay(replay.kt:18)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1.invokeSuspend(TestCaseExecutor.kt:227)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1$1.invoke(TestCaseExecutor.kt)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$4.invokeSuspend(ExecutorExecutionContext.kt:77)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$4.invoke(ExecutorExecutionContext.kt)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$4.invoke(ExecutorExecutionContext.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:165)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
at io.kotest.engine.ExecutorExecutionContext.executeWithTimeoutInterruption(ExecutorExecutionContext.kt:75)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1.invokeSuspend(TestCaseExecutor.kt:220)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4$1.invoke(TestCaseExecutor.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturnIgnoreTimeout(Undispatched.kt:100)
at kotlinx.coroutines.TimeoutKt.setupTimeout(Timeout.kt:148)
at kotlinx.coroutines.TimeoutKt.withTimeout(Timeout.kt:44)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4.invokeSuspend(TestCaseExecutor.kt:219)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$4.invoke(TestCaseExecutor.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.SupervisorKt.supervisorScope(Supervisor.kt:61)
at io.kotest.core.internal.TestCaseExecutor.executeAndWait(TestCaseExecutor.kt:215)
at io.kotest.core.internal.TestCaseExecutor.invokeTestCase(TestCaseExecutor.kt:184)
at io.kotest.core.internal.TestCaseExecutor.executeActiveTest(TestCaseExecutor.kt:153)
at io.kotest.core.internal.TestCaseExecutor.access$executeActiveTest(TestCaseExecutor.kt:57)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1$1.invokeSuspend(TestCaseExecutor.kt:89)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor.executeIfEnabled(TestCaseExecutor.kt:117)
at io.kotest.core.internal.TestCaseExecutor.access$executeIfEnabled(TestCaseExecutor.kt:57)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1.invokeSuspend(TestCaseExecutor.kt:89)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor.intercept(TestCaseExecutor.kt:103)
at io.kotest.core.internal.TestCaseExecutor.execute(TestCaseExecutor.kt:69)
at io.kotest.engine.spec.runners.SingleInstanceSpecRunner.runTest(SingleInstanceSpecRunner.kt:104)
at io.kotest.engine.spec.runners.SingleInstanceSpecRunner.access$runTest(SingleInstanceSpecRunner.kt:34)
at io.kotest.engine.spec.runners.SingleInstanceSpecRunner$execute$interceptAndRun$2$4.invokeSuspend(SingleInstanceSpecRunner.kt:57)
at io.kotest.engine.spec.runners.SingleInstanceSpecRunner$execute$interceptAndRun$2$4.invoke(SingleInstanceSpecRunner.kt)
at io.kotest.engine.spec.runners.SingleInstanceSpecRunner$execute$interceptAndRun$2$4.invoke(SingleInstanceSpecRunner.kt)
at io.kotest.engine.launchers.SequentialTestLauncher$launch$3$1$1.invokeSuspend(SequentialTestLauncher.kt:22)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:831)
이럴때 아래와 같이 every
를 써주면 된다.
test("안심번호 연결 함수는 전화번호가 주어지면 안심번호를 생성하고 연결이력을 저장한 후 안심번호를 반환한다.") {
val originNumber = "01012341234"
val safetyNumber = "050437973400"
every { generator.generate(originNumber) } returns safetyNumber
every { repository.save(any()) } returns SafetyNumberLinkageHistory(originNumber, safetyNumber, ASSIGNED)
val actual = sut.linkSafetyNumber(originNumber)
actual shouldBe safetyNumber
verify {
val entityMatch = match<SafetyNumberLinkageHistory> {
it.originNumber == originNumber &&
it.safetyNumber == safetyNumber &&
it.status == ASSIGNED
}
repository.save(entityMatch)
}
}
command test에 every를 쓰는게 좀 맘에 안드지만 현재까지 찾은 해결방법이 이거니...일단 이걸로 해결하자... 왠지 hint를 통해서 해결할 수도 있을것 같은데 잘 동작안해서 일단 패스
저번에도 밟았던거 같은데..... Transactional 이 필요한 환경에서는 nested test를 쓸수 없다 ㅡㅡ.... 코루틴 때문인거 같은데 좀 고쳐줘.....
intellij show heap
https://www.jetbrains.com/help/idea/increasing-memory-heap.html
JPA 모델에서 insert시 ID가 신규인지 체크하지 않도록 하기 위해서는 아래와 같이 isNew를 오버라이드 하면됨
@Entity
class Thing implements Pesistable<Long> {
var value: Int,
@Id
@GeneratedValue
var id: Long = -1
@Transient
private boolean isNew = true;
@PostPersist
@PostLoad
void markNotNew() {
this.isNew = false;
}
@Override
boolean isNew() {
return isNew;
}
}
테라폼에서 RDS 비밀번호 KMS로 하기
mariadb parameter group family 불러오는 쿼리
aws rds describe-db-engine-versions --query "DBEngineVersions[].DBParameterGroupFamily" --engine mariadb
Intellij 파일 마지막에 새로운 라인 생기게 하는 법
circleci에서 jib를 이용한 ecr image push
config.yml
version: 2.1
orbs:
aws-ecr: circleci/aws-ecr@7.2.0
jobs:
push:
docker:
- image: cimg/openjdk:16.0.2
resource_class: samll
working_directory: ~/workspace
steps:
- checkout
- aws-ecr/ecr-login:
account-url: ECR_ACCOUNT_URL
aws-access-key-id: ECR_ACCESS_KEY_ID
aws-secret-access-key: ECR_SECRET_ACCESS_KEY
- run:
name: push
command: ./gradlew jib
프로젝트 환경변수
slack user group id를 얻으려면 슬렉을 웹으로 켠다음 사용자 그룹 상세 화면을 열고 개발자 도구를 통해 id를 얻을 수 잇다.
webclient 에서 blockin을 사용하는 경우 에러를 뿜음. 왜그런고 하니 reactor가 별도 스레드에서 동작할때에는 blocking 시 예외를 던지도록 설계되어있음. 이게 테스트 환경에서는 제대로 동작안함 ㅡㅡ (물론 모킹을 이용한 유닛 테스트였음), 통합테스트는 해봐야겟다
jackson을 이용해서 빈문자열이 존재할 수 있으면 아래와 같이 하면 된다.
public class DatePojo {
@JsonInclude(value= JsonInclude.Include.NON_EMPTY)
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="dd-MMM-yyyy", timezone="PST")
@JsonProperty("date")
private Date date;
}
flyway 마이그레이션 만들때 브랜치별로 마이그레이션 파일을 따로만든다면 버전 정책을 잘잡아야한다.
공통 버전을 1, 2, ,3, 4 이렇게 가져가고 브랜치 버전을 1.1, 2.1, 2.2 이런식으로 가야함
그럴일이 많지 않지만 부득이하게 Spring Boot에서 api를 content-type을 text/plain으로 하려면 @RequestBody의 객체 타입을 String으로 해야한다..............후.....
@RestController
class SampleController {
@PostMapping("/sample", produces = [MediaType.TEXT_PLAIN_VALUE], consumes = [MediaType.TEXT_PLAIN_VALUE])
fun sample(@RequestBody data: String) {
println(data)
}
}
jackson 쓸대 localDateTime 파싱 에러 뜨면 JavaTimeModule을 추가하면된다.
val mapper = jacksonMapperBuilder()
.addModule(JavaTimeModule())
.build()
OCR 오픈소스 중에 한글지원되는 게 있네
graphene interface
동일한 필드에 여러타입을 정의하고 싶을때
https://docs.graphene-python.org/en/latest/types/interfaces/
if-else switch 를 사용하기보다 팩토리를 사용하자
https://blog.cleancoder.com/uncle-bob/2021/03/06/ifElseSwitch.html