Skip to content

Built the link to the nested class for the JavaDocs #1395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<ParamNamesTag>().firstOrNull()?.names
parameterNameMap = { index -> names?.getOrNull(index) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ open class FuzzedMethodDescription(
val parameters: List<ClassId>,
val concreteValues: Collection<FuzzedConcreteValue> = emptyList()
) {

/**
* Name that can be used to generate test names
*/
Expand All @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down