@@ -109,7 +109,7 @@ import org.utbot.framework.codegen.StaticsMocking
109109import org.utbot.framework.codegen.TestFramework
110110import org.utbot.framework.codegen.TestNg
111111import org.utbot.framework.codegen.model.util.MOCKITO_EXTENSIONS_FILE_CONTENT
112- import org.utbot.framework.codegen.model.util.MOCKITO_EXTENSIONS_STORAGE
112+ import org.utbot.framework.codegen.model.util.MOCKITO_EXTENSIONS_FOLDER
113113import org.utbot.framework.codegen.model.util.MOCKITO_MOCKMAKER_FILE_NAME
114114import org.utbot.framework.plugin.api.CodeGenerationSettingItem
115115import org.utbot.framework.plugin.api.CodegenLanguage
@@ -762,15 +762,15 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m
762762 * for further details.
763763 */
764764 private fun configureMockitoResources (testResourcesPath : Path ) {
765- val mockitoExtensionsPath = " $testResourcesPath /$MOCKITO_EXTENSIONS_STORAGE " .toPath()
765+ val mockitoExtensionsPath = " $testResourcesPath /$MOCKITO_EXTENSIONS_FOLDER " .toPath()
766766 val mockitoMockMakerPath = " $mockitoExtensionsPath /$MOCKITO_MOCKMAKER_FILE_NAME " .toPath()
767767
768768 if (! testResourcesPath.exists()) Files .createDirectory(testResourcesPath)
769769 if (! mockitoExtensionsPath.exists()) Files .createDirectory(mockitoExtensionsPath)
770770
771771 if (! mockitoMockMakerPath.exists()) {
772772 Files .createFile(mockitoMockMakerPath)
773- Files .write(mockitoMockMakerPath, MOCKITO_EXTENSIONS_FILE_CONTENT )
773+ Files .write(mockitoMockMakerPath, listOf ( MOCKITO_EXTENSIONS_FILE_CONTENT ) )
774774 }
775775 }
776776
@@ -1027,14 +1027,20 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m
10271027 .map { f -> Paths .get(urlToPath(f.url)) }
10281028 }
10291029
1030- return entriesPaths.all { path ->
1031- if (Files .exists(path)) {
1032- val fileNames = Files .walk(path).map { it.fileName }.toList()
1033- fileNames.any { it.toString() == MOCKITO_MOCKMAKER_FILE_NAME }
1034- } else {
1035- false
1030+ return entriesPaths.all { entryPath ->
1031+ if (! Files .exists(entryPath)) return false
1032+
1033+ val mockMakerPath = " $entryPath /$MOCKITO_EXTENSIONS_FOLDER /$MOCKITO_MOCKMAKER_FILE_NAME " .toPath()
1034+ if (! Files .exists(mockMakerPath)) return false
1035+
1036+ try {
1037+ val fileLines = Files .readAllLines(mockMakerPath)
1038+ fileLines.singleOrNull() == MOCKITO_EXTENSIONS_FILE_CONTENT
1039+ } catch (e: java.io.IOException ) {
1040+ return false
1041+ }
1042+
10361043 }
1037- }
10381044 }
10391045}
10401046
0 commit comments