diff options
| author | Paul-Christian Volkmer | 2026-04-24 11:19:28 +0200 |
|---|---|---|
| committer | GitHub | 2026-04-24 09:19:28 +0000 |
| commit | 615115dad8fb260bea6ea3436c1d239777b42df1 (patch) | |
| tree | 585602883907688cb77980da655c9989397bbecd /src/test/kotlin/dev/dnpm/etl | |
| parent | 185a35a1e02adcddd42d25861b19b4360071368b (diff) | |
refactor: JacksonConfig for deprecated MappingJackson2HttpMessageConverter (#285)
Diffstat (limited to 'src/test/kotlin/dev/dnpm/etl')
| -rw-r--r-- | src/test/kotlin/dev/dnpm/etl/processor/config/JacksonConfigTest.kt | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/test/kotlin/dev/dnpm/etl/processor/config/JacksonConfigTest.kt b/src/test/kotlin/dev/dnpm/etl/processor/config/JacksonConfigTest.kt new file mode 100644 index 0000000..9042d8c --- /dev/null +++ b/src/test/kotlin/dev/dnpm/etl/processor/config/JacksonConfigTest.kt @@ -0,0 +1,50 @@ +package dev.dnpm.etl.processor.config + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ValueSource +import java.util.* + +class JacksonConfigTest { + + lateinit var jacksonConfig: JacksonConfig + + @BeforeEach + fun setup() { + this.jacksonConfig = JacksonConfig() + } + + @ParameterizedTest + @ValueSource(strings = [ + "mv64e-mtb-fake-patient.json", + "fake_broadConsent_mii_response_deny.json", + "fake_broadConsent_mii_response_permit.json", + ]) + fun shouldSerializeJsonWithoutNulledOutFields(filename: String) { + val inputJson = + Objects.requireNonNull(this.javaClass.classLoader.getResourceAsStream(filename))?.readAllBytes()?.decodeToString() + + val json = this.jacksonConfig.objectMapper().readTree(inputJson) + val actual = this.jacksonConfig.objectMapper().writeValueAsString(json) + + assertThat(actual).doesNotContain("null") + } + + @ParameterizedTest + @ValueSource(strings = [ + "fake_broadConsent_mii_response_deny.json", + "fake_broadConsent_mii_response_permit.json", + ]) + fun shouldSerializeConsentWithoutWithoutDatesAsTimestamps(filename: String) { + val inputJson = + Objects.requireNonNull(this.javaClass.classLoader.getResourceAsStream(filename))?.readAllBytes()?.decodeToString() + + val json = this.jacksonConfig.objectMapper().readTree(inputJson) + val actual = this.jacksonConfig.objectMapper().writeValueAsString(json) + + assertThat(actual).contains(""""lastUpdated":"2025-08-15T11:13:59.143+02:00"""") + } + +} |
