Skip to content

Commit

Permalink
Avoid remembering and restoring enum constants #1397 #306 (#1416)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorkaKulikov authored Nov 25, 2022
1 parent 57a7454 commit 4b9ca2d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,12 @@ 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 }
.filterNot { it.value.classId.outerClass?.isEnum == true }

rememberInitialStaticFields(statics)
val stateAnalyzer = ExecutionStateAnalyzer(execution)
val modificationInfo = stateAnalyzer.findModifiedFields()
Expand Down

0 comments on commit 4b9ca2d

Please sign in to comment.