From 1df6a6e2e8399d3740218f0b00e4a3ec3ed8679f Mon Sep 17 00:00:00 2001 From: DarkAtra Date: Wed, 29 May 2024 20:22:07 +0200 Subject: [PATCH] fix: ignore null values in `Character#killedVBloods` --- .../discord/clients/botcompanion/BotCompanionClient.kt | 4 ++++ .../vrising/discord/clients/botcompanion/model/Character.kt | 4 ++++ .../discord/clients/botcompanion/BotCompanionClientTest.kt | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/de/darkatra/vrising/discord/clients/botcompanion/BotCompanionClient.kt b/src/main/kotlin/de/darkatra/vrising/discord/clients/botcompanion/BotCompanionClient.kt index ec20500..05e8446 100644 --- a/src/main/kotlin/de/darkatra/vrising/discord/clients/botcompanion/BotCompanionClient.kt +++ b/src/main/kotlin/de/darkatra/vrising/discord/clients/botcompanion/BotCompanionClient.kt @@ -69,3 +69,7 @@ class BotCompanionClient { .build() } } + +fun main() { + BotCompanionClient().getCharacters("141.98.19.254", 25570, emptyList()) +} diff --git a/src/main/kotlin/de/darkatra/vrising/discord/clients/botcompanion/model/Character.kt b/src/main/kotlin/de/darkatra/vrising/discord/clients/botcompanion/model/Character.kt index 115d150..e0a3f74 100644 --- a/src/main/kotlin/de/darkatra/vrising/discord/clients/botcompanion/model/Character.kt +++ b/src/main/kotlin/de/darkatra/vrising/discord/clients/botcompanion/model/Character.kt @@ -1,8 +1,12 @@ package de.darkatra.vrising.discord.clients.botcompanion.model +import com.fasterxml.jackson.annotation.JsonSetter +import com.fasterxml.jackson.annotation.Nulls + data class Character( val name: String, val gearLevel: Int, val clan: String?, + @field:JsonSetter(contentNulls = Nulls.SKIP) val killedVBloods: List ) diff --git a/src/test/kotlin/de/darkatra/vrising/discord/clients/botcompanion/BotCompanionClientTest.kt b/src/test/kotlin/de/darkatra/vrising/discord/clients/botcompanion/BotCompanionClientTest.kt index 28d50f4..52b9238 100644 --- a/src/test/kotlin/de/darkatra/vrising/discord/clients/botcompanion/BotCompanionClientTest.kt +++ b/src/test/kotlin/de/darkatra/vrising/discord/clients/botcompanion/BotCompanionClientTest.kt @@ -38,7 +38,8 @@ class BotCompanionClientTest { "clan": "Test", "killedVBloods": [ "FOREST_WOLF", - "BANDIT_STONEBREAKER" + "BANDIT_STONEBREAKER", + null ] } ]""".trimIndent()