diff --git a/utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt b/utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt index c5519721a9..fb0ce9855f 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt @@ -432,6 +432,8 @@ class UtBotSymbolicEngine( val methodUnderTestDescription = FuzzedMethodDescription(methodUnderTest, collectConstantsForFuzzer(graph)).apply { compilableName = if (!methodUnderTest.isConstructor) methodUnderTest.name else null className = classUnderTest.simpleName + canonicalName = classUnderTest.canonicalName + isNested = classUnderTest.isNested packageName = classUnderTest.packageName val names = graph.body.method.tags.filterIsInstance().firstOrNull()?.names parameterNameMap = { index -> names?.getOrNull(index) } diff --git a/utbot-fuzzers/src/main/kotlin/org/utbot/fuzzer/FuzzedMethodDescription.kt b/utbot-fuzzers/src/main/kotlin/org/utbot/fuzzer/FuzzedMethodDescription.kt index f81806a752..206c82961a 100644 --- a/utbot-fuzzers/src/main/kotlin/org/utbot/fuzzer/FuzzedMethodDescription.kt +++ b/utbot-fuzzers/src/main/kotlin/org/utbot/fuzzer/FuzzedMethodDescription.kt @@ -19,7 +19,6 @@ open class FuzzedMethodDescription( val parameters: List, val concreteValues: Collection = emptyList() ) { - /** * Name that can be used to generate test names */ @@ -35,6 +34,16 @@ open class FuzzedMethodDescription( */ var packageName: String? = null + /** + * Canonical name. + */ + var canonicalName: String? = null + + /** + * True, if class is nested. + */ + var isNested: Boolean = false + /** * Returns parameter name by its index in the signature */ diff --git a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/classic/fuzzer/SimpleCommentForTestProducedByFuzzerBuilder.kt b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/classic/fuzzer/SimpleCommentForTestProducedByFuzzerBuilder.kt index 11f6780246..ee272f2f3a 100644 --- a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/classic/fuzzer/SimpleCommentForTestProducedByFuzzerBuilder.kt +++ b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/classic/fuzzer/SimpleCommentForTestProducedByFuzzerBuilder.kt @@ -20,9 +20,11 @@ class SimpleCommentForTestProducedByFuzzerBuilder( val packageName = methodDescription.packageName val className = methodDescription.className val methodName = methodDescription.compilableName + val canonicalName = methodDescription.canonicalName + val isNested = methodDescription.isNested val result = if (packageName != null && className != null && methodName != null) { - val fullClassName = getFullClassName(packageName, className) + val fullClassName = getFullClassName(canonicalName, packageName, className, isNested) val methodReference = getMethodReferenceForFuzzingTest( fullClassName, diff --git a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/customtags/CustomTagsUtil.kt b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/customtags/CustomTagsUtil.kt index fda4050170..5d503461f2 100644 --- a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/customtags/CustomTagsUtil.kt +++ b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/customtags/CustomTagsUtil.kt @@ -75,6 +75,10 @@ fun getClassReference(fullClassName: String): String { } /** Returns correct full class name. */ -fun getFullClassName(packageName: String, className: String): String { - return if (packageName.isEmpty()) className else "$packageName.$className" +fun getFullClassName(canonicalName: String?, packageName: String, className: String, isNested: Boolean): String { + return if (isNested && canonicalName != null) { + canonicalName + } else { + if (packageName.isEmpty()) className else "$packageName.$className" + } } \ No newline at end of file diff --git a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/customtags/fuzzer/CommentWithCustomTagForTestProducedByFuzzerBuilder.kt b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/customtags/fuzzer/CommentWithCustomTagForTestProducedByFuzzerBuilder.kt index 0a417eca29..ca65e00a8c 100644 --- a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/customtags/fuzzer/CommentWithCustomTagForTestProducedByFuzzerBuilder.kt +++ b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/customtags/fuzzer/CommentWithCustomTagForTestProducedByFuzzerBuilder.kt @@ -5,7 +5,6 @@ import org.utbot.framework.plugin.api.DocStatement import org.utbot.framework.plugin.api.UtExecutionResult import org.utbot.fuzzer.FuzzedMethodDescription import org.utbot.fuzzer.FuzzedValue -import org.utbot.summary.SummarySentenceConstants.CARRIAGE_RETURN import org.utbot.summary.comment.customtags.getClassReference import org.utbot.summary.comment.customtags.getFullClassName import org.utbot.summary.comment.customtags.getMethodReferenceForFuzzingTest @@ -34,9 +33,11 @@ class CommentWithCustomTagForTestProducedByFuzzerBuilder( val packageName = methodDescription.packageName val className = methodDescription.className val methodName = methodDescription.compilableName + val canonicalName = methodDescription.canonicalName + val isNested = methodDescription.isNested return if (packageName != null && className != null && methodName != null) { - val fullClassName = getFullClassName(packageName, className) + val fullClassName = getFullClassName(canonicalName, packageName, className, isNested) val methodReference = getMethodReferenceForFuzzingTest( fullClassName,