Skip to content

Commit

Permalink
chore: improve error messages in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkAtra committed Nov 5, 2024
1 parent 546f03c commit 7b794cd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class BotRuntimeHints : RuntimeHintsRegistrar {
// required by ktor (dependency of kord)
hints.reflection()
.registerType(DefaultPool::class.java, MemberCategory.DECLARED_FIELDS)
.registerType(StickerPackData::class.java)

// required for kotlinx serialization (dependency of kord)
hints.reflection()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ class BotCompanionClientTest {
val charactersResult = runBlocking {
botCompanionClient.getCharacters("localhost", wireMockRuntimeInfo.httpPort)
}
assertThat(charactersResult.isSuccess).isTrue()
assertThat(charactersResult.isSuccess).withFailMessage {
charactersResult.exceptionOrNull()?.message
}.isTrue()

val characters = charactersResult.getOrThrow()
assertThat(characters).isNotEmpty()
Expand Down Expand Up @@ -130,7 +132,9 @@ class BotCompanionClientTest {
val charactersResult = runBlocking {
botCompanionClient.getCharacters("localhost", wireMockRuntimeInfo.httpPort, username, password)
}
assertThat(charactersResult.isSuccess).isTrue()
assertThat(charactersResult.isSuccess).withFailMessage {
charactersResult.exceptionOrNull()?.message
}.isTrue()

val characters = charactersResult.getOrThrow()
assertThat(characters).isNotEmpty()
Expand Down Expand Up @@ -203,7 +207,9 @@ class BotCompanionClientTest {
val playerActivitiesResult = runBlocking {
botCompanionClient.getPlayerActivities("localhost", wireMockRuntimeInfo.httpPort)
}
assertThat(playerActivitiesResult.isSuccess).isTrue()
assertThat(playerActivitiesResult.isSuccess).withFailMessage {
playerActivitiesResult.exceptionOrNull()?.message
}.isTrue()

val playerActivities = playerActivitiesResult.getOrThrow()
assertThat(playerActivities).isNotEmpty()
Expand Down Expand Up @@ -248,7 +254,9 @@ class BotCompanionClientTest {
val pvpKillsResult = runBlocking {
botCompanionClient.getPvpKills("localhost", wireMockRuntimeInfo.httpPort)
}
assertThat(pvpKillsResult.isSuccess).isTrue()
assertThat(pvpKillsResult.isSuccess).withFailMessage {
pvpKillsResult.exceptionOrNull()?.message
}.isTrue()

val pvpKills = pvpKillsResult.getOrThrow()
assertThat(pvpKills).isNotEmpty()
Expand Down

0 comments on commit 7b794cd

Please sign in to comment.