From b50acf3ee5d8537f83ea6dbc6b866eda1d3658dc Mon Sep 17 00:00:00 2001 From: Bart van Helvert Date: Mon, 23 Aug 2021 09:30:49 +0200 Subject: [PATCH] [jvm] SerializableHasSerialVersionUidFieldInspection add Kotlin test Adds test for when the companion object already exists. GitOrigin-RevId: da17be785a77d2440689505ed1d95f42c946d754 --- ...eHasSerialVersionUidFieldInspectionTest.kt | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/jvm/jvm-analysis-kotlin-tests/testSrc/com/intellij/codeInspection/tests/kotlin/KotlinSerializableHasSerialVersionUidFieldInspectionTest.kt b/jvm/jvm-analysis-kotlin-tests/testSrc/com/intellij/codeInspection/tests/kotlin/KotlinSerializableHasSerialVersionUidFieldInspectionTest.kt index 12be3626de02..6a354985f4f8 100644 --- a/jvm/jvm-analysis-kotlin-tests/testSrc/com/intellij/codeInspection/tests/kotlin/KotlinSerializableHasSerialVersionUidFieldInspectionTest.kt +++ b/jvm/jvm-analysis-kotlin-tests/testSrc/com/intellij/codeInspection/tests/kotlin/KotlinSerializableHasSerialVersionUidFieldInspectionTest.kt @@ -30,4 +30,25 @@ class KotlinSerializableHasSerialVersionUidFieldInspectionTest : SerializableHas } """.trimIndent(), "Add 'serialVersionUID' field") } + + fun `test quickfix companion exists`() { + myFixture.testQuickFix(ULanguage.KOTLIN, """ + import java.io.Serializable + + class Foo : Serializable { + companion object { + val bar = 0 + } + } + """.trimIndent(), """ + import java.io.Serializable + + class Foo : Serializable { + companion object { + private const val serialVersionUID: Long = -7315889077010185135L + val bar = 0 + } + } + """.trimIndent(), "Add 'serialVersionUID' field") + } } \ No newline at end of file