File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,9 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m
192
192
private val codegenLanguages = createComboBox(CodegenLanguage .values())
193
193
private val testFrameworks = createComboBox(TestFramework .allItems.toTypedArray())
194
194
195
+ private val javaConfigurationHelper = SpringConfigurationsHelper (" ." )
196
+ private val xmlConfigurationHelper = SpringConfigurationsHelper (File .separator)
197
+
195
198
private val springConfig = createComboBoxWithSeparatorsForSpringConfigs(shortenConfigurationNames())
196
199
197
200
private val mockStrategies = createComboBox(MockStrategyApi .values())
@@ -218,10 +221,6 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m
218
221
parametrizedTestSources to null
219
222
)
220
223
221
-
222
- private val javaConfigurationHelper = SpringConfigurationsHelper (" ." )
223
- private val xmlConfigurationHelper = SpringConfigurationsHelper (File .separator)
224
-
225
224
private fun shortenConfigurationNames (): Set <Pair <String ?, Collection <String >>> {
226
225
val shortenedSortedSpringConfigurationClasses =
227
226
javaConfigurationHelper.shortenSpringConfigNames(model.getSortedSpringConfigurationClasses())
Original file line number Diff line number Diff line change @@ -46,10 +46,12 @@ class SpringConfigurationsHelper(val separator: String) {
46
46
fullNames.forEach { nameToInfo[it] = NameInfo (it) }
47
47
var nameInfoCollection = nameToInfo.values
48
48
49
- while (nameInfoCollection.size != nameInfoCollection.distinct().size) {
49
+ // this cycle continues until all shortenedNames become unique
50
+ while (nameInfoCollection.size != nameInfoCollection.distinctBy { it.shortenedName }.size) {
50
51
nameInfoCollection = nameInfoCollection.sortedBy { it.shortenedName }.toMutableList()
51
52
52
- for (index in nameInfoCollection.indices) {
53
+ var index = 0
54
+ while (index < nameInfoCollection.size){
53
55
val curShortenedPath = nameInfoCollection[index].shortenedName
54
56
55
57
// here we search a block of shortened paths that are equivalent
@@ -64,8 +66,9 @@ class SpringConfigurationsHelper(val separator: String) {
64
66
}
65
67
}
66
68
67
- // if the size of this block is one, we should not enlarge it
69
+ // if the size of this block is one, we should not enlarge it
68
70
if (index == maxIndexWithSamePath - 1 ) {
71
+ index++
69
72
continue
70
73
}
71
74
@@ -75,6 +78,9 @@ class SpringConfigurationsHelper(val separator: String) {
75
78
return collectShortenedNames()
76
79
}
77
80
}
81
+
82
+ // after enlarging the block, we proceed to search for the next block
83
+ index = maxIndexWithSamePath
78
84
}
79
85
}
80
86
You can’t perform that action at this time.
0 commit comments