diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/CodeGenerator.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/CodeGenerator.kt index c79dc7b260..850863e4b9 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/CodeGenerator.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/CodeGenerator.kt @@ -24,6 +24,7 @@ import org.utbot.framework.plugin.api.UtMethodTestSet import org.utbot.framework.codegen.model.constructor.TestClassModel import org.utbot.framework.codegen.model.tree.CgDocRegularStmt import org.utbot.framework.codegen.model.tree.CgDocumentationComment +import java.util.* class CodeGenerator( private val classUnderTest: ClassId, @@ -147,11 +148,11 @@ sealed class UtilClassKind( /** * Contains comments specifying the version and the kind of util class being generated and */ - val utilClassDocumentation: CgDocumentationComment - get() = CgDocumentationComment( + fun utilClassDocumentation(codegenLanguage: CodegenLanguage): CgDocumentationComment + = CgDocumentationComment( listOf( CgDocRegularStmt(utilClassKindCommentText), - CgDocRegularStmt("$UTIL_CLASS_VERSION_COMMENT_PREFIX${utilClassVersion}"), + CgDocRegularStmt("$UTIL_CLASS_VERSION_COMMENT_PREFIX${utilClassVersion(codegenLanguage)}"), ) ) @@ -159,8 +160,8 @@ sealed class UtilClassKind( * The version of util class being generated. * For more details see [UtilClassFileMethodProvider.UTIL_CLASS_VERSION]. */ - val utilClassVersion: String - get() = UtilClassFileMethodProvider.UTIL_CLASS_VERSION + fun utilClassVersion(codegenLanguage: CodegenLanguage): String + = UtilClassFileMethodProvider(codegenLanguage).UTIL_CLASS_VERSION /** * The text of comment specifying the kind of util class. @@ -175,7 +176,12 @@ sealed class UtilClassKind( /** * A kind of regular UtUtils class. "Regular" here means that this class does not use a mock framework. */ - object RegularUtUtils : UtilClassKind(UtilClassFileMethodProvider, mockFrameworkUsed = false, priority = 0) { + class RegularUtUtils(val codegenLanguage: CodegenLanguage) : + UtilClassKind( + UtilClassFileMethodProvider(codegenLanguage), + mockFrameworkUsed = false, + priority = 0, + ) { override val utilClassKindCommentText: String get() = "This is a regular UtUtils class (without mock framework usage)" } @@ -183,7 +189,8 @@ sealed class UtilClassKind( /** * A kind of UtUtils class that uses a mock framework. At the moment the framework is Mockito. */ - object UtUtilsWithMockito : UtilClassKind(UtilClassFileMethodProvider, mockFrameworkUsed = true, priority = 1) { + class UtUtilsWithMockito(val codegenLanguage: CodegenLanguage) : + UtilClassKind(UtilClassFileMethodProvider(codegenLanguage), mockFrameworkUsed = true, priority = 1) { override val utilClassKindCommentText: String get() = "This is UtUtils class with Mockito support" } @@ -197,7 +204,7 @@ sealed class UtilClassKind( * @return the text of the generated util class file. */ fun getUtilClassText(codegenLanguage: CodegenLanguage): String { - val utilClassFile = CgUtilClassConstructor.constructUtilsClassFile(this) + val utilClassFile = CgUtilClassConstructor.constructUtilsClassFile(this, codegenLanguage) val renderer = CgAbstractRenderer.makeRenderer(this, codegenLanguage) utilClassFile.accept(renderer) return renderer.toString() @@ -212,10 +219,13 @@ sealed class UtilClassKind( */ const val UTIL_CLASS_VERSION_COMMENT_PREFIX = "UtUtils class version: " - fun utilClassKindByCommentOrNull(comment: String): UtilClassKind? { + fun utilClassKindByCommentOrNull( + comment: String, + codegenLanguage: CodegenLanguage) + : UtilClassKind? { return when (comment) { - RegularUtUtils.utilClassKindCommentText -> RegularUtUtils - UtUtilsWithMockito.utilClassKindCommentText -> UtUtilsWithMockito + RegularUtUtils(codegenLanguage).utilClassKindCommentText -> RegularUtUtils(codegenLanguage) + UtUtilsWithMockito(codegenLanguage).utilClassKindCommentText -> UtUtilsWithMockito(codegenLanguage) else -> null } } @@ -228,24 +238,27 @@ sealed class UtilClassKind( internal fun fromCgContextOrNull(context: CgContext): UtilClassKind? { if (context.requiredUtilMethods.isEmpty()) return null if (!context.mockFrameworkUsed) { - return RegularUtUtils + return RegularUtUtils(context.codegenLanguage) } return when (context.mockFramework) { - MockFramework.MOCKITO -> UtUtilsWithMockito + MockFramework.MOCKITO -> UtUtilsWithMockito(context.codegenLanguage) // in case we will add any other mock frameworks, newer Kotlin compiler versions // will report a non-exhaustive 'when', so we will not forget to support them here as well } } - const val UT_UTILS_PACKAGE_NAME = "org.utbot.runtime.utils" - const val UT_UTILS_CLASS_NAME = "UtUtils" + const val UT_UTILS_BASE_PACKAGE_NAME = "org.utbot.runtime.utils" + const val UT_UTILS_INSTANCE_NAME = "UtUtils" const val PACKAGE_DELIMITER = "." /** - * List of package names of UtUtils class. - * See whole package name at [UT_UTILS_PACKAGE_NAME]. + * List of package name components of UtUtils class. + * See whole package name at [UT_UTILS_BASE_PACKAGE_NAME]. */ - val utilsPackages: List - get() = UT_UTILS_PACKAGE_NAME.split(PACKAGE_DELIMITER) + fun utilsPackageNames(codegenLanguage: CodegenLanguage): List + = UT_UTILS_BASE_PACKAGE_NAME.split(PACKAGE_DELIMITER) + codegenLanguage.name.lowercase(Locale.getDefault()) + + fun utilsPackageFullName(codegenLanguage: CodegenLanguage): String + = utilsPackageNames(codegenLanguage).joinToString { PACKAGE_DELIMITER } } } diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/builtin/UtilMethodBuiltins.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/builtin/UtilMethodBuiltins.kt index 68f970c336..1c07a0df13 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/builtin/UtilMethodBuiltins.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/builtin/UtilMethodBuiltins.kt @@ -1,6 +1,8 @@ package org.utbot.framework.codegen.model.constructor.builtin import org.utbot.framework.codegen.MockitoStaticMocking +import org.utbot.framework.codegen.model.UtilClassKind.Companion.PACKAGE_DELIMITER +import org.utbot.framework.codegen.model.UtilClassKind.Companion.UT_UTILS_BASE_PACKAGE_NAME import org.utbot.framework.codegen.model.constructor.util.arrayTypeOf import org.utbot.framework.codegen.model.constructor.util.utilMethodId import org.utbot.framework.codegen.model.tree.CgClassId @@ -8,6 +10,7 @@ import org.utbot.framework.codegen.model.visitor.utilMethodTextById import org.utbot.framework.plugin.api.BuiltinClassId import org.utbot.framework.plugin.api.BuiltinConstructorId import org.utbot.framework.plugin.api.ClassId +import org.utbot.framework.plugin.api.CodegenLanguage import org.utbot.framework.plugin.api.MethodId import org.utbot.framework.plugin.api.util.baseStreamClassId import org.utbot.framework.plugin.api.util.booleanClassId @@ -253,11 +256,12 @@ internal abstract class UtilMethodProvider(val utilClassId: ClassId) { /** * This provider represents an util class file that is generated and put into the user's test module. - * The generated class is UtUtils (its id is defined at [utUtilsClassId]). + * The generated class is UtUtils (its id is defined at [utJavaUtilsClassId] or [utKotlinUtilsClassId]). * * Content of this util class may be different (due to mocks in deepEquals), but the methods (and their ids) are the same. */ -internal object UtilClassFileMethodProvider : UtilMethodProvider(utUtilsClassId) { +internal class UtilClassFileMethodProvider(language: CodegenLanguage) + : UtilMethodProvider(selectUtilClassId(language)) { /** * This property contains the current version of util class. * This version will be written to the util class file inside a comment. @@ -270,14 +274,27 @@ internal object UtilClassFileMethodProvider : UtilMethodProvider(utUtilsClassId) * * **IMPORTANT** if you make any changes to util methods (see [utilMethodTextById]), do not forget to update this version. */ - const val UTIL_CLASS_VERSION = "1.0" + val UTIL_CLASS_VERSION = "2.0" } internal class TestClassUtilMethodProvider(testClassId: ClassId) : UtilMethodProvider(testClassId) -internal val utUtilsClassId: ClassId +internal fun selectUtilClassId(codegenLanguage: CodegenLanguage): ClassId = + when (codegenLanguage) { + CodegenLanguage.JAVA -> utJavaUtilsClassId + CodegenLanguage.KOTLIN -> utKotlinUtilsClassId + } + +internal val utJavaUtilsClassId: ClassId + get() = BuiltinClassId( + canonicalName = UT_UTILS_BASE_PACKAGE_NAME + PACKAGE_DELIMITER + "java" + PACKAGE_DELIMITER + "UtUtils", + simpleName = "UtUtils", + isFinal = true, + ) + +internal val utKotlinUtilsClassId: ClassId get() = BuiltinClassId( - canonicalName = "org.utbot.runtime.utils.UtUtils", + canonicalName = UT_UTILS_BASE_PACKAGE_NAME + PACKAGE_DELIMITER + "kotlin" + PACKAGE_DELIMITER + "UtUtils", simpleName = "UtUtils", isFinal = true, isKotlinObject = true diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/context/CgContext.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/context/CgContext.kt index 4530f05df9..d37de756c0 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/context/CgContext.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/context/CgContext.kt @@ -508,7 +508,7 @@ internal data class CgContext( */ override val utilMethodProvider: UtilMethodProvider get() = if (generateUtilClassFile) { - UtilClassFileMethodProvider + UtilClassFileMethodProvider(codegenLanguage) } else { TestClassUtilMethodProvider(outerMostTestClass) } diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgUtilClassConstructor.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgUtilClassConstructor.kt index e17509ef62..53c53eb615 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgUtilClassConstructor.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgUtilClassConstructor.kt @@ -2,7 +2,9 @@ package org.utbot.framework.codegen.model.constructor.tree import org.utbot.framework.codegen.model.CodeGenerator import org.utbot.framework.codegen.model.UtilClassKind -import org.utbot.framework.codegen.model.constructor.builtin.utUtilsClassId +import org.utbot.framework.codegen.model.constructor.builtin.selectUtilClassId +import org.utbot.framework.codegen.model.constructor.builtin.utJavaUtilsClassId +import org.utbot.framework.codegen.model.constructor.builtin.utKotlinUtilsClassId import org.utbot.framework.codegen.model.tree.CgAuxiliaryClass import org.utbot.framework.codegen.model.tree.CgAuxiliaryNestedClassesRegion import org.utbot.framework.codegen.model.tree.CgClassFile @@ -11,21 +13,26 @@ import org.utbot.framework.codegen.model.tree.CgUtilMethod import org.utbot.framework.codegen.model.tree.buildClass import org.utbot.framework.codegen.model.tree.buildClassBody import org.utbot.framework.codegen.model.tree.buildClassFile +import org.utbot.framework.plugin.api.CodegenLanguage /** * This class is used to construct a file containing an util class UtUtils. * The util class is constructed when the argument `generateUtilClassFile` in the [CodeGenerator] is true. */ internal object CgUtilClassConstructor { - fun constructUtilsClassFile(utilClassKind: UtilClassKind): CgClassFile { + fun constructUtilsClassFile( + utilClassKind: UtilClassKind, + codegenLanguage: CodegenLanguage, + ): CgClassFile { val utilMethodProvider = utilClassKind.utilMethodProvider + val utilsClassId = selectUtilClassId(codegenLanguage) return buildClassFile { // imports are empty, because we use fully qualified classes and static methods, // so they will be imported once IDEA reformatting action has worked declaredClass = buildClass { - id = utUtilsClassId - body = buildClassBody(utUtilsClassId) { - documentation = utilClassKind.utilClassDocumentation + id = utilsClassId + body = buildClassBody(utilsClassId) { + documentation = utilClassKind.utilClassDocumentation(codegenLanguage) staticDeclarationRegions += CgStaticsRegion("Util methods", utilMethodProvider.utilMethodIds.map { CgUtilMethod(it) }) nestedClassRegions += CgAuxiliaryNestedClassesRegion( nestedClasses = listOf( diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/visitor/CgRendererContext.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/visitor/CgRendererContext.kt index 92963984cb..3e695b0d42 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/visitor/CgRendererContext.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/visitor/CgRendererContext.kt @@ -1,9 +1,11 @@ package org.utbot.framework.codegen.model.visitor import org.utbot.framework.codegen.model.UtilClassKind -import org.utbot.framework.codegen.model.UtilClassKind.Companion.UT_UTILS_PACKAGE_NAME +import org.utbot.framework.codegen.model.UtilClassKind.Companion.utilsPackageFullName import org.utbot.framework.codegen.model.constructor.builtin.UtilMethodProvider -import org.utbot.framework.codegen.model.constructor.builtin.utUtilsClassId +import org.utbot.framework.codegen.model.constructor.builtin.selectUtilClassId +import org.utbot.framework.codegen.model.constructor.builtin.utJavaUtilsClassId +import org.utbot.framework.codegen.model.constructor.builtin.utKotlinUtilsClassId import org.utbot.framework.codegen.model.constructor.context.CgContext import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.CodegenLanguage @@ -46,8 +48,8 @@ internal class CgRendererContext( shouldOptimizeImports = false, importedClasses = emptySet(), importedStaticMethods = emptySet(), - classPackageName = UT_UTILS_PACKAGE_NAME, - generatedClass = utUtilsClassId, + classPackageName = utilsPackageFullName(language), + generatedClass = selectUtilClassId(language), utilMethodProvider = utilClassKind.utilMethodProvider, codegenLanguage = language, mockFrameworkUsed = utilClassKind.mockFrameworkUsed, diff --git a/utbot-framework/src/main/kotlin/org/utbot/tests/infrastructure/TestCodeGeneratorPipeline.kt b/utbot-framework/src/main/kotlin/org/utbot/tests/infrastructure/TestCodeGeneratorPipeline.kt index 7fca8e52f3..fec4ed43bb 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/tests/infrastructure/TestCodeGeneratorPipeline.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/tests/infrastructure/TestCodeGeneratorPipeline.kt @@ -12,7 +12,7 @@ import org.utbot.framework.codegen.TestFramework import org.utbot.framework.codegen.model.CodeGenerator import org.utbot.framework.codegen.model.CodeGeneratorResult import org.utbot.framework.codegen.model.UtilClassKind -import org.utbot.framework.codegen.model.UtilClassKind.Companion.UT_UTILS_CLASS_NAME +import org.utbot.framework.codegen.model.UtilClassKind.Companion.UT_UTILS_INSTANCE_NAME import org.utbot.framework.plugin.api.CodegenLanguage import org.utbot.framework.plugin.api.ExecutableId import org.utbot.framework.plugin.api.MockFramework @@ -171,7 +171,7 @@ class TestCodeGeneratorPipeline(private val testFrameworkConfiguration: TestFram } private fun UtilClassKind.writeUtilClassToFile(buildDirectory: Path, language: CodegenLanguage): File { - val utilClassFile = File(buildDirectory.toFile(), "$UT_UTILS_CLASS_NAME${language.extension}") + val utilClassFile = File(buildDirectory.toFile(), "$UT_UTILS_INSTANCE_NAME${language.extension}") val utilClassText = getUtilClassText(language) return writeFile(utilClassText, utilClassFile) } diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/CodeGenerationController.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/CodeGenerationController.kt index 9fbe00cb76..8b8aa67b08 100644 --- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/CodeGenerationController.kt +++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/CodeGenerationController.kt @@ -68,7 +68,7 @@ import org.utbot.framework.codegen.ParametrizedTestSource import org.utbot.framework.codegen.RegularImport import org.utbot.framework.codegen.StaticImport import org.utbot.framework.codegen.model.UtilClassKind -import org.utbot.framework.codegen.model.UtilClassKind.Companion.UT_UTILS_CLASS_NAME +import org.utbot.framework.codegen.model.UtilClassKind.Companion.UT_UTILS_INSTANCE_NAME import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.CodegenLanguage import org.utbot.intellij.plugin.inspection.UnitTestBotInspectionManager @@ -241,7 +241,7 @@ object CodeGenerationController { ?: return // no util class needed val existingUtilClass = model.codegenLanguage.getUtilClassOrNull(model.project, model.testModule) - val utilClassKind = newUtilClassKindOrNull(existingUtilClass, requiredUtilClassKind) + val utilClassKind = newUtilClassKindOrNull(existingUtilClass, requiredUtilClassKind, model.codegenLanguage) if (utilClassKind != null) { createOrUpdateUtilClass( testDirectory = baseTestDirectory, @@ -267,17 +267,21 @@ object CodeGenerationController { * @param requiredUtilClassKind the kind of the new util class that we attempt to generate. * @return an [UtilClassKind] of a new util class that will be created or `null`, if no new util class is needed. */ - private fun newUtilClassKindOrNull(existingUtilClass: PsiFile?, requiredUtilClassKind: UtilClassKind): UtilClassKind? { + private fun newUtilClassKindOrNull( + existingUtilClass: PsiFile?, + requiredUtilClassKind: UtilClassKind, + codegenLanguage: CodegenLanguage, + ): UtilClassKind? { if (existingUtilClass == null) { // If no util class exists, then we should create a new one with the given kind. return requiredUtilClassKind } val existingUtilClassVersion = existingUtilClass.utilClassVersionOrNull ?: return requiredUtilClassKind - val newUtilClassVersion = requiredUtilClassKind.utilClassVersion + val newUtilClassVersion = requiredUtilClassKind.utilClassVersion(codegenLanguage) val versionIsUpdated = existingUtilClassVersion != newUtilClassVersion - val existingUtilClassKind = existingUtilClass.utilClassKindOrNull ?: return requiredUtilClassKind + val existingUtilClassKind = existingUtilClass.utilClassKindOrNull(codegenLanguage) ?: return requiredUtilClassKind if (versionIsUpdated) { // If an existing util class is out of date, then we must overwrite it with a newer version. @@ -322,7 +326,7 @@ object CodeGenerationController { val utUtilsFile = if (existingUtilClass == null) { // create a directory to put utils class into - val utilClassDirectory = createUtUtilSubdirectories(testDirectory) + val utilClassDirectory = createUtUtilSubdirectories(testDirectory, language) // create util class file and put it into utils directory createNewUtilClass(utilClassDirectory, language, utilClassKind, model) } else { @@ -432,8 +436,8 @@ object CodeGenerationController { * Util class must have a comment that specifies its kind. * This property obtains the kind specified by this comment if it exists. Otherwise, the property is `null`. */ - private val PsiFile.utilClassKindOrNull: UtilClassKind? - get() = runReadAction { + private fun PsiFile.utilClassKindOrNull(codegenLanguage: CodegenLanguage): UtilClassKind? + = runReadAction { val utilClass = (this as? PsiClassOwner) ?.classes ?.firstOrNull() @@ -441,8 +445,7 @@ object CodeGenerationController { utilClass.getChildrenOfType() .map { comment -> comment.text } - .mapNotNull { text -> UtilClassKind.utilClassKindByCommentOrNull(text) } - .firstOrNull() + .firstNotNullOfOrNull { text -> UtilClassKind.utilClassKindByCommentOrNull(text, codegenLanguage) } } /** @@ -464,14 +467,17 @@ object CodeGenerationController { } private val CodegenLanguage.utilClassFileName: String - get() = "$UT_UTILS_CLASS_NAME${this.extension}" + get() = "$UT_UTILS_INSTANCE_NAME${this.extension}" /** * @param testDirectory root test directory where we will put our generated tests. * @return directory for util class if it exists or null otherwise. */ - private fun getUtilDirectoryOrNull(testDirectory: PsiDirectory): PsiDirectory? { - val directoryNames = UtilClassKind.utilsPackages + private fun getUtilDirectoryOrNull( + testDirectory: PsiDirectory, + codegenLanguage: CodegenLanguage, + ): PsiDirectory? { + val directoryNames = UtilClassKind.utilsPackageNames(codegenLanguage) var currentDirectory = testDirectory for (name in directoryNames) { val subdirectory = runReadAction { currentDirectory.findSubdirectory(name) } ?: return null @@ -484,9 +490,12 @@ object CodeGenerationController { * @param testDirectory root test directory where we will put our generated tests. * @return file of util class if it exists or null otherwise. */ - private fun CodegenLanguage.getUtilClassOrNull(testDirectory: PsiDirectory): PsiFile? { + private fun CodegenLanguage.getUtilClassOrNull( + testDirectory: PsiDirectory, + codegenLanguage: CodegenLanguage, + ): PsiFile? { return runReadAction { - val utilDirectory = getUtilDirectoryOrNull(testDirectory) + val utilDirectory = getUtilDirectoryOrNull(testDirectory, codegenLanguage) utilDirectory?.findFile(this.utilClassFileName) } } @@ -508,17 +517,18 @@ object CodeGenerationController { } // return an util class from one of the test source roots or null if no util class was found - return testRoots - .mapNotNull { testRoot -> getUtilClassOrNull(testRoot) } - .firstOrNull() + return testRoots.firstNotNullOfOrNull { testRoot -> getUtilClassOrNull(testRoot, this) } } /** * Create all package directories for UtUtils class. * @return the innermost directory - utils from `org.utbot.runtime.utils` */ - private fun createUtUtilSubdirectories(baseTestDirectory: PsiDirectory): PsiDirectory { - val directoryNames = UtilClassKind.utilsPackages + private fun createUtUtilSubdirectories( + baseTestDirectory: PsiDirectory, + codegenLanguage: CodegenLanguage, + ): PsiDirectory { + val directoryNames = UtilClassKind.utilsPackageNames(codegenLanguage) var currentDirectory = baseTestDirectory runWriteCommandAction(baseTestDirectory.project) { for (name in directoryNames) { diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/process/EngineProcess.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/process/EngineProcess.kt index 73bc6382f8..26809779f5 100644 --- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/process/EngineProcess.kt +++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/process/EngineProcess.kt @@ -321,10 +321,10 @@ class EngineProcess(parent: Lifetime, val project: Project) { ) ) result.generatedCode to result.utilClassKind?.let { - if (UtilClassKind.RegularUtUtils.javaClass.simpleName == it) - UtilClassKind.RegularUtUtils + if (UtilClassKind.RegularUtUtils(codegenLanguage).javaClass.simpleName == it) + UtilClassKind.RegularUtUtils(codegenLanguage) else - UtilClassKind.UtUtilsWithMockito + UtilClassKind.UtUtilsWithMockito(codegenLanguage) } }