@@ -90,7 +90,6 @@ import javax.swing.JComboBox
90
90
import javax.swing.JComponent
91
91
import javax.swing.JList
92
92
import javax.swing.JPanel
93
- import kotlin.streams.toList
94
93
import org.jetbrains.concurrency.Promise
95
94
import org.jetbrains.concurrency.thenRun
96
95
import org.jetbrains.kotlin.asJava.classes.KtUltraLightClass
@@ -106,7 +105,7 @@ import org.utbot.framework.codegen.StaticsMocking
106
105
import org.utbot.framework.codegen.TestFramework
107
106
import org.utbot.framework.codegen.TestNg
108
107
import org.utbot.framework.codegen.model.util.MOCKITO_EXTENSIONS_FILE_CONTENT
109
- import org.utbot.framework.codegen.model.util.MOCKITO_EXTENSIONS_STORAGE
108
+ import org.utbot.framework.codegen.model.util.MOCKITO_EXTENSIONS_FOLDER
110
109
import org.utbot.framework.codegen.model.util.MOCKITO_MOCKMAKER_FILE_NAME
111
110
import org.utbot.framework.plugin.api.CodeGenerationSettingItem
112
111
import org.utbot.framework.plugin.api.CodegenLanguage
@@ -746,15 +745,15 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m
746
745
* for further details.
747
746
*/
748
747
private fun configureMockitoResources (testResourcesPath : Path ) {
749
- val mockitoExtensionsPath = " $testResourcesPath /$MOCKITO_EXTENSIONS_STORAGE " .toPath()
748
+ val mockitoExtensionsPath = " $testResourcesPath /$MOCKITO_EXTENSIONS_FOLDER " .toPath()
750
749
val mockitoMockMakerPath = " $mockitoExtensionsPath /$MOCKITO_MOCKMAKER_FILE_NAME " .toPath()
751
750
752
751
if (! testResourcesPath.exists()) Files .createDirectory(testResourcesPath)
753
752
if (! mockitoExtensionsPath.exists()) Files .createDirectory(mockitoExtensionsPath)
754
753
755
754
if (! mockitoMockMakerPath.exists()) {
756
755
Files .createFile(mockitoMockMakerPath)
757
- Files .write(mockitoMockMakerPath, MOCKITO_EXTENSIONS_FILE_CONTENT )
756
+ Files .write(mockitoMockMakerPath, listOf ( MOCKITO_EXTENSIONS_FILE_CONTENT ) )
758
757
}
759
758
}
760
759
@@ -1013,7 +1012,12 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m
1013
1012
1014
1013
return entriesPaths.all { entryPath ->
1015
1014
if (! Files .exists(entryPath)) return false
1016
- Files .walk(entryPath).anyMatch { it.fileName.toString() == MOCKITO_MOCKMAKER_FILE_NAME }
1015
+
1016
+ val mockMakerPath = " $entryPath /$MOCKITO_EXTENSIONS_FOLDER /$MOCKITO_MOCKMAKER_FILE_NAME " .toPath()
1017
+ if (! Files .exists(mockMakerPath)) return false
1018
+
1019
+ val fileLines = Files .readAllLines(mockMakerPath)
1020
+ fileLines.singleOrNull() == MOCKITO_EXTENSIONS_FILE_CONTENT
1017
1021
}
1018
1022
}
1019
1023
}
0 commit comments