@@ -5,6 +5,8 @@ import org.utbot.framework.plugin.api.*
5
5
import org.utbot.framework.plugin.api.util.voidClassId
6
6
import org.utbot.fuzzer.FuzzedMethodDescription
7
7
import org.utbot.fuzzer.FuzzedValue
8
+ import org.utbot.summary.SummarySentenceConstants.FROM_TO_NAMES_COLON
9
+ import org.utbot.summary.SummarySentenceConstants.FROM_TO_NAMES_TRANSITION
8
10
import org.utbot.summary.UtSummarySettings
9
11
import org.utbot.summary.comment.classic.fuzzer.SimpleCommentForTestProducedByFuzzerBuilder
10
12
import org.utbot.summary.comment.customtags.fuzzer.CommentWithCustomTagForTestProducedByFuzzerBuilder
@@ -33,8 +35,8 @@ class ModelBasedNameSuggester(
33
35
34
36
return sequenceOf(
35
37
TestSuggestedInfo (
36
- testName = createTestName(description, values, result),
37
- displayName = createDisplayName(description, values, result),
38
+ testName = if ( UtSummarySettings . GENERATE_NAMES ) createTestName(description, values, result) else null ,
39
+ displayName = if ( UtSummarySettings . GENERATE_DISPLAY_NAMES ) createDisplayName(description, values, result) else null ,
38
40
javaDoc = if (UtSummarySettings .GENERATE_COMMENTS ) createJavaDoc(description, values, result) else null
39
41
)
40
42
)
@@ -104,12 +106,17 @@ class ModelBasedNameSuggester(
104
106
* Result example:
105
107
* 1. **Full name**: `firstArg = 12, secondArg < 100.0, thirdArg = empty string -> throw IllegalArgumentException`
106
108
* 2. **Name without appropriate information**: `arg_0 = 0 and others -> return 0`
109
+ *
110
+ * NOTE: The ```:``` symbol is used as a separator instead
111
+ * of ```->``` if the [UtSummarySettings.GENERATE_DISPLAYNAME_FROM_TO_STYLE] is false.
107
112
*/
108
113
private fun createDisplayName (
109
114
description : FuzzedMethodDescription ,
110
115
values : List <FuzzedValue >,
111
116
result : UtExecutionResult ?
112
117
): String {
118
+ val displayNameSeparator = if (UtSummarySettings .GENERATE_DISPLAYNAME_FROM_TO_STYLE ) FROM_TO_NAMES_TRANSITION else FROM_TO_NAMES_COLON
119
+
113
120
val summaries = values.asSequence()
114
121
.mapIndexed { index, value ->
115
122
value.summary?.replace(" %var%" , description.parameterNameMap(index) ? : " arg_$index " )
@@ -127,13 +134,13 @@ class ModelBasedNameSuggester(
127
134
val returnValue = when (result) {
128
135
is UtExecutionSuccess -> result.model.let { m ->
129
136
when {
130
- m is UtPrimitiveModel && m.classId != voidClassId -> " -> return " + m.value
131
- m is UtNullModel -> " -> return null"
137
+ m is UtPrimitiveModel && m.classId != voidClassId -> " $displayNameSeparator return " + m.value
138
+ m is UtNullModel -> " $displayNameSeparator return null"
132
139
else -> null
133
140
}
134
141
}
135
142
136
- is UtExplicitlyThrownException , is UtImplicitlyThrownException -> " -> throw ${(result as UtExecutionFailure ).exception::class .java.simpleName} "
143
+ is UtExplicitlyThrownException , is UtImplicitlyThrownException -> " $displayNameSeparator throw ${(result as UtExecutionFailure ).exception::class .java.simpleName} "
137
144
else -> null
138
145
}
139
146
0 commit comments