From 4fc0b1d8fba312b2c0df97c832fff7517dc68256 Mon Sep 17 00:00:00 2001 From: Kirill Shishin Date: Fri, 15 Dec 2023 14:21:40 +0300 Subject: [PATCH] Fix Mockito version update --- .../plugin/api/utils/DependencyPatterns.kt | 15 +++++++++++++-- .../framework/plugin/api/utils/DependencyUtils.kt | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/utils/DependencyPatterns.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/utils/DependencyPatterns.kt index 57397e0d4c..8a4f3e1729 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/utils/DependencyPatterns.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/utils/DependencyPatterns.kt @@ -58,6 +58,16 @@ fun MockFramework.patterns(): Patterns { return Patterns(moduleLibraryPatterns, libraryPatterns) } +fun MockFramework.manifestPatterns(): Patterns { + val moduleLibraryPatterns = when (this) { + MockFramework.MOCKITO -> mockitoManifestPatterns + } + val libraryPatterns = when (this) { + MockFramework.MOCKITO -> mockitoManifestPatterns + } + return Patterns(moduleLibraryPatterns, libraryPatterns) +} + val JUNIT_4_JAR_PATTERN = Regex("junit-4(\\.1[2-9])(\\.[0-9]+)?") val JUNIT_4_MVN_PATTERN = Regex("junit:junit:4(\\.1[2-9])(\\.[0-9]+)?") val junit4Patterns = listOf(JUNIT_4_JAR_PATTERN, JUNIT_4_MVN_PATTERN) @@ -87,9 +97,10 @@ val testNgModulePatterns = listOf(TEST_NG_BASIC_MODULE_PATTERN) val MOCKITO_JAR_PATTERN = Regex("mockito-core-[3-9](\\.[0-9]+){2}") val MOCKITO_MVN_PATTERN = Regex("org\\.mockito:mockito-core:[3-9](\\.[0-9]+){2}") val mockitoPatterns = listOf(MOCKITO_JAR_PATTERN, MOCKITO_MVN_PATTERN) +val mockitoModulePatterns = listOf(MOCKITO_JAR_PATTERN, MOCKITO_MVN_PATTERN) -val MOCKITO_BASIC_MODULE_PATTERN = Regex("mockito-core") -val mockitoModulePatterns = listOf(MOCKITO_BASIC_MODULE_PATTERN) +val MOCKITO_MANIFEST_PATTERN = Regex("mockito-core") +val mockitoManifestPatterns = listOf(MOCKITO_MANIFEST_PATTERN) const val MOCKITO_EXTENSIONS_FOLDER = "mockito-extensions" const val MOCKITO_MOCKMAKER_FILE_NAME = "org.mockito.plugins.MockMaker" diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/utils/DependencyUtils.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/utils/DependencyUtils.kt index 8d6b201ac1..285c30e33f 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/utils/DependencyUtils.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/utils/DependencyUtils.kt @@ -43,7 +43,7 @@ fun checkFrameworkDependencies(dependencyPaths: String?) { // ) // } - val mockFrameworkPatterns = MockFramework.allItems.map { it.patterns() } + val mockFrameworkPatterns = MockFramework.allItems.map { it.manifestPatterns() } val mockFrameworkFound = dependencyNames.matchesAnyOf(mockFrameworkPatterns) || dependencyPathsSequence.any { checkDependencyIsFatJar(it) }