From 1ba23f0bfb337a944f753e9c583b94eb1028c8bb Mon Sep 17 00:00:00 2001 From: Egor Kulikov Date: Wed, 23 Nov 2022 15:38:57 +0300 Subject: [PATCH 1/3] Avoid remembering and restoring enum constants --- .../org/utbot/framework/codegen/tree/CgMethodConstructor.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgMethodConstructor.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgMethodConstructor.kt index 89f1e9a36b..6aea94fcc7 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgMethodConstructor.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgMethodConstructor.kt @@ -1361,7 +1361,11 @@ open class CgMethodConstructor(val context: CgContext) : CgContextOwner by conte // TODO: remove this line when SAT-1273 is completed execution.displayName = execution.displayName?.let { "${executableId.name}: $it" } testMethod(testMethodName, execution.displayName) { - val statics = currentExecution!!.stateBefore.statics + //Enum constants are static, but there is no need to store and recover value for them + val statics = currentExecution!!.stateBefore + .statics + .filterNot { it.value is UtEnumConstantModel } + rememberInitialStaticFields(statics) val stateAnalyzer = ExecutionStateAnalyzer(execution) val modificationInfo = stateAnalyzer.findModifiedFields() From 38bf5fdd0a0139a63cc458bb37563e31bb0bdf3a Mon Sep 17 00:00:00 2001 From: Egor Kulikov Date: Fri, 25 Nov 2022 12:02:10 +0300 Subject: [PATCH 2/3] Add additional filtering --- .../org/utbot/framework/codegen/tree/CgMethodConstructor.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgMethodConstructor.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgMethodConstructor.kt index 6aea94fcc7..8b8d5b8ebc 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgMethodConstructor.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgMethodConstructor.kt @@ -1365,6 +1365,7 @@ open class CgMethodConstructor(val context: CgContext) : CgContextOwner by conte val statics = currentExecution!!.stateBefore .statics .filterNot { it.value is UtEnumConstantModel } + .filterNot { it.value.classId.outerClass?.isEnum == true } rememberInitialStaticFields(statics) val stateAnalyzer = ExecutionStateAnalyzer(execution) From 5d190a8021f9f57ea7b41eea36c91fdfd3d47cd8 Mon Sep 17 00:00:00 2001 From: Egor Kulikov Date: Fri, 25 Nov 2022 12:04:14 +0300 Subject: [PATCH 3/3] Disable test again --- .../kotlin/org/utbot/examples/enums/ComplexEnumExamplesTest.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utbot-framework-test/src/test/kotlin/org/utbot/examples/enums/ComplexEnumExamplesTest.kt b/utbot-framework-test/src/test/kotlin/org/utbot/examples/enums/ComplexEnumExamplesTest.kt index a3c02068b8..b4d969962e 100644 --- a/utbot-framework-test/src/test/kotlin/org/utbot/examples/enums/ComplexEnumExamplesTest.kt +++ b/utbot-framework-test/src/test/kotlin/org/utbot/examples/enums/ComplexEnumExamplesTest.kt @@ -1,5 +1,6 @@ package org.utbot.examples.enums +import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test import org.utbot.examples.enums.ComplexEnumExamples.Color import org.utbot.examples.enums.ComplexEnumExamples.Color.BLUE @@ -74,6 +75,7 @@ class ComplexEnumExamplesTest : UtValueTestCaseChecker( } @Test + @Disabled("TODO: nested anonymous classes are not supported: https://github.com/UnitTestBot/UTBotJava/issues/617") fun testFindState() { check( ComplexEnumExamples::findState,