diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/Domain.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/Domain.kt index 142ae27d79..ee6f72fa17 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/Domain.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/Domain.kt @@ -737,12 +737,12 @@ enum class ProjectType { JavaScript, } -enum class TypeReplacementApproach { +sealed class TypeReplacementApproach { /** * Do not replace interfaces and abstract classes with concrete implementors. * Use mocking instead of it. */ - DO_NOT_REPLACE, + object DoNotReplace : TypeReplacementApproach() /** * Try to replace interfaces and abstract classes with concrete implementors @@ -751,7 +751,7 @@ enum class TypeReplacementApproach { * * Currently used in Spring applications only. */ - REPLACE_IF_POSSIBLE, + class ReplaceIfPossible(val configFqn: String) : TypeReplacementApproach() } abstract class DependencyInjectionFramework( diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/UtTestsDialogProcessor.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/UtTestsDialogProcessor.kt index 8978bdb61f..b369f59b33 100644 --- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/UtTestsDialogProcessor.kt +++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/UtTestsDialogProcessor.kt @@ -180,8 +180,8 @@ object UtTestsDialogProcessor { val applicationContext = when (model.projectType) { Spring -> { val shouldUseImplementors = when (model.typeReplacementApproach) { - TypeReplacementApproach.DO_NOT_REPLACE -> false - TypeReplacementApproach.REPLACE_IF_POSSIBLE -> true + TypeReplacementApproach.DoNotReplace -> false + is TypeReplacementApproach.ReplaceIfPossible -> true } SpringApplicationContext( diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/GenerateTestsDialogWindow.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/GenerateTestsDialogWindow.kt index 72ef532b62..03bcdb5181 100644 --- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/GenerateTestsDialogWindow.kt +++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/GenerateTestsDialogWindow.kt @@ -546,8 +546,8 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m model.typeReplacementApproach = when (springConfig.item) { - NO_SPRING_CONFIGURATION_OPTION -> TypeReplacementApproach.DO_NOT_REPLACE - else -> TypeReplacementApproach.REPLACE_IF_POSSIBLE + NO_SPRING_CONFIGURATION_OPTION -> TypeReplacementApproach.DoNotReplace + else -> TypeReplacementApproach.ReplaceIfPossible(springConfig.item) } val settings = model.project.service()