From 0a535f29aa02a3df7162fd6027b059ab990d2014 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 9 May 2024 16:51:58 +0000 Subject: [PATCH] Update dependency com.cjbooms:fabrikt to v16 --- build.gradle.kts | 2 +- .../IgnoreUnknownPropertiesProcessorTest.kt | 25 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 3782be1..2f88db9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -36,7 +36,7 @@ repositories { } dependencies { - implementation("com.cjbooms:fabrikt:15.3.0") + implementation("com.cjbooms:fabrikt:16.1.0") testImplementation(kotlin("test")) detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6") } diff --git a/src/test/kotlin/ch/acanda/gradle/fabrikt/processor/IgnoreUnknownPropertiesProcessorTest.kt b/src/test/kotlin/ch/acanda/gradle/fabrikt/processor/IgnoreUnknownPropertiesProcessorTest.kt index e9fe41b..b4749b1 100644 --- a/src/test/kotlin/ch/acanda/gradle/fabrikt/processor/IgnoreUnknownPropertiesProcessorTest.kt +++ b/src/test/kotlin/ch/acanda/gradle/fabrikt/processor/IgnoreUnknownPropertiesProcessorTest.kt @@ -70,15 +70,12 @@ class IgnoreUnknownPropertiesProcessorTest : StringSpec({ addIgnoreUnknownPropertiesAnnotation(modelsDirectory) - val modelClass = modelsDirectory.resolve("Animal.kt").readText() - modelClass shouldBe """ + // the base class should not be annotated + modelsDirectory.resolve("Animal.kt").readText() shouldBe """ |package a.b.models | - |import com.fasterxml.jackson.`annotation`.JsonIgnoreProperties - |import com.fasterxml.jackson.`annotation`.JsonProperty |import com.fasterxml.jackson.`annotation`.JsonSubTypes |import com.fasterxml.jackson.`annotation`.JsonTypeInfo - |import javax.validation.constraints.NotNull | |@JsonTypeInfo( | use = JsonTypeInfo.Id.NAME, @@ -92,6 +89,16 @@ class IgnoreUnknownPropertiesProcessorTest : StringSpec({ | public abstract val type: AnimalDiscriminatorType |} | + """.trimMargin() + + // only the data classes should be annotated + modelsDirectory.resolve("Dog.kt").readText() shouldBe """ + |package a.b.models + | + |import com.fasterxml.jackson.`annotation`.JsonIgnoreProperties + |import com.fasterxml.jackson.`annotation`.JsonProperty + |import javax.validation.constraints.NotNull + | |@JsonIgnoreProperties(ignoreUnknown = true) |public data class Dog( | @get:JsonProperty("type") @@ -100,14 +107,6 @@ class IgnoreUnknownPropertiesProcessorTest : StringSpec({ | override val type: AnimalDiscriminatorType = AnimalDiscriminatorType.DOG, |) : Animal() | - |@JsonIgnoreProperties(ignoreUnknown = true) - |public data class Cat( - | @get:JsonProperty("type") - | @get:NotNull - | @param:JsonProperty("type") - | override val type: AnimalDiscriminatorType = AnimalDiscriminatorType.CAT, - |) : Animal() - | """.trimMargin() }