Skip to content

Commit 05e5714

Browse files
authored
release: 2.3.0 (#409)
2 parents 7ced140 + 1c9c4e0 commit 05e5714

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed

โ€Žsrc/main/kotlin/org/gitanimals/supports/orchestrate/NetxUserOrchestrator.ktโ€Ž

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,18 @@ class NetxUserOrchestrator(
7878
}
7979
).commitWithContext(
8080
contextOrchestrate = TraceIdContextOrchestrator { _, request ->
81-
identityApi.updateUserByAuthInfo(
82-
entryPoint = request.entryPoint,
83-
authenticationId = request.authenticationId,
84-
request = UsernameUpdateRequest(changedName = request.changeName),
85-
)
81+
runCatching {
82+
identityApi.updateUserByAuthInfo(
83+
entryPoint = request.entryPoint,
84+
authenticationId = request.authenticationId,
85+
request = UsernameUpdateRequest(changedName = request.changeName),
86+
)
87+
}.getOrElse {
88+
if (it is IllegalArgumentException) {
89+
return@getOrElse
90+
}
91+
throw it
92+
}
8693
}
8794
)
8895

โ€Žsrc/test/kotlin/org/gitanimals/supports/orchestrate/NetxUserOrchestratorTest.ktโ€Ž

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,17 @@ internal class NetxUserOrchestratorTest(
143143
}
144144
}
145145

146-
context("identityApi ์„œ๋ฒ„์˜ ์œ ์ € ์ •๋ณด ์—…๋ฐ์ดํŠธ ์ค‘์— ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด") {
146+
context("identityApi ์„œ๋ฒ„์˜ ์œ ์ € ์ •๋ณด ์—…๋ฐ์ดํŠธ ์ค‘์— IllegalArgumentException์ด ์•„๋‹Œ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด") {
147147
val beforeName = "xb"
148148
val (user, rank) = setUpTestDataWithUsername(beforeName)
149149
val afterName = "after-xb"
150150

151151
it("๋ชจ๋“  ๋ณ€๊ฒฝ์„ ์ด์ „ ์ด๋ฆ„์œผ๋กœ ๋กค๋ฐฑํ•œ๋‹ค") {
152152
every {
153153
identityApi.updateUserByAuthInfo(any(), any(), any())
154-
} throws IllegalArgumentException("Some error")
154+
} throws IllegalStateException("Some error")
155155

156-
shouldThrowExactly<IllegalArgumentException> {
156+
shouldThrowExactly<IllegalStateException> {
157157
animationFacade.getFarmAnimation(afterName)
158158
}
159159

@@ -164,6 +164,26 @@ internal class NetxUserOrchestratorTest(
164164
}
165165
}
166166
}
167+
168+
context("identityApi ์„œ๋ฒ„์˜ ์œ ์ € ์ •๋ณด ์—…๋ฐ์ดํŠธ ์ค‘์— IllegalArgumentException ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด") {
169+
val beforeName = "xb"
170+
val (user, rank) = setUpTestDataWithUsername(beforeName)
171+
val afterName = "after-xb"
172+
173+
it("๋ฌด์‹œํ•œ๋‹ค") {
174+
every {
175+
identityApi.updateUserByAuthInfo(any(), any(), any())
176+
} throws IllegalArgumentException("Some error")
177+
178+
animationFacade.getFarmAnimation(afterName)
179+
180+
eventually(5.seconds) {
181+
userRepository.findByIdOrNull(user.id)?.getName() shouldBe afterName
182+
userContributionRankRepository.findByIdOrNull(rank.id)?.username shouldBe afterName
183+
guildRepository.findAllGuildByUsernameWithMembers(afterName).count() shouldBe 2
184+
}
185+
}
186+
}
167187
}
168188
}) {
169189
companion object {

0 commit comments

Comments
ย (0)