diff --git a/lib/src/apiTest/kotlin/com/lemonappdev/konsist/architecture/assertarchitecture/architecture2/Architecture2Test.kt b/lib/src/apiTest/kotlin/com/lemonappdev/konsist/architecture/assertarchitecture/architecture2/Architecture2Test.kt index f0565f2430..372124d5ec 100644 --- a/lib/src/apiTest/kotlin/com/lemonappdev/konsist/architecture/assertarchitecture/architecture2/Architecture2Test.kt +++ b/lib/src/apiTest/kotlin/com/lemonappdev/konsist/architecture/assertarchitecture/architecture2/Architecture2Test.kt @@ -11,9 +11,12 @@ import org.amshove.kluent.shouldBeEqualTo import org.junit.jupiter.api.Test class Architecture2Test { - private val rootPath = PathProvider.getInstance().rootProjectPath + private val rootPath = PathProvider.rootProjectPath private val domain = - Layer("Domain", "com.lemonappdev.konsist.architecture.assertarchitecture.architecture2.project.domain..") + Layer( + "Domain", + "com.lemonappdev.konsist.architecture.assertarchitecture.architecture2.project.domain..", + ) private val presentation = Layer( "Presentation", diff --git a/lib/src/apiTest/kotlin/com/lemonappdev/konsist/architecture/optionalparameters/OptionalParametersTest.kt b/lib/src/apiTest/kotlin/com/lemonappdev/konsist/architecture/optionalparameters/OptionalParametersTest.kt index 7fde9620e2..acf4f3669b 100644 --- a/lib/src/apiTest/kotlin/com/lemonappdev/konsist/architecture/optionalparameters/OptionalParametersTest.kt +++ b/lib/src/apiTest/kotlin/com/lemonappdev/konsist/architecture/optionalparameters/OptionalParametersTest.kt @@ -11,7 +11,7 @@ import org.amshove.kluent.shouldBeEqualTo import org.junit.jupiter.api.Test class OptionalParametersTest { - private val rootPath = PathProvider.getInstance().rootProjectPath + private val rootPath = PathProvider.rootProjectPath private val domain = Layer("Domain", "com.lemonappdev.konsist.architecture.optionalparameters.project.domain..") private val presentation = diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koclass/KoClassDeclarationForKoDeclarationProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koclass/KoClassDeclarationForKoFileDeclarationProviderTest.kt similarity index 99% rename from lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koclass/KoClassDeclarationForKoDeclarationProviderTest.kt rename to lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koclass/KoClassDeclarationForKoFileDeclarationProviderTest.kt index f04757f0c6..ab21d41b7d 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koclass/KoClassDeclarationForKoDeclarationProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koclass/KoClassDeclarationForKoFileDeclarationProviderTest.kt @@ -11,7 +11,7 @@ import org.amshove.kluent.assertSoftly import org.amshove.kluent.shouldBeEqualTo import org.junit.jupiter.api.Test -class KoClassDeclarationForKoDeclarationProviderTest { +class KoClassDeclarationForKoFileDeclarationProviderTest { @Test fun `class-has-no-declarations`() { // given diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kofile/KoFileDeclarationForKoDeclarationProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kofile/KoFileDeclarationForKoFileDeclarationProviderTest.kt similarity index 99% rename from lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kofile/KoFileDeclarationForKoDeclarationProviderTest.kt rename to lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kofile/KoFileDeclarationForKoFileDeclarationProviderTest.kt index 63d1f16b3d..5bf50ef6b0 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kofile/KoFileDeclarationForKoDeclarationProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kofile/KoFileDeclarationForKoFileDeclarationProviderTest.kt @@ -14,7 +14,7 @@ import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments.arguments import org.junit.jupiter.params.provider.MethodSource -class KoFileDeclarationForKoDeclarationProviderTest { +class KoFileDeclarationForKoFileDeclarationProviderTest { @Test fun `file-has-two-declarations`() { // given diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kointerface/KoInterfaceDeclarationForKoDeclarationProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kointerface/KoInterfaceDeclarationForKoFileDeclarationProviderTest.kt similarity index 99% rename from lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kointerface/KoInterfaceDeclarationForKoDeclarationProviderTest.kt rename to lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kointerface/KoInterfaceDeclarationForKoFileDeclarationProviderTest.kt index c1bf87e34d..68a6e4033a 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kointerface/KoInterfaceDeclarationForKoDeclarationProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kointerface/KoInterfaceDeclarationForKoFileDeclarationProviderTest.kt @@ -11,7 +11,7 @@ import org.amshove.kluent.assertSoftly import org.amshove.kluent.shouldBeEqualTo import org.junit.jupiter.api.Test -class KoInterfaceDeclarationForKoDeclarationProviderTest { +class KoInterfaceDeclarationForKoFileDeclarationProviderTest { @Test fun `interface-has-no-declarations`() { // given diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koobject/KoObjectDeclarationForKoDeclarationProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koobject/KoObjectDeclarationForKoFileDeclarationProviderTest.kt similarity index 99% rename from lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koobject/KoObjectDeclarationForKoDeclarationProviderTest.kt rename to lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koobject/KoObjectDeclarationForKoFileDeclarationProviderTest.kt index 288b4c189b..65815ba50e 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koobject/KoObjectDeclarationForKoDeclarationProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koobject/KoObjectDeclarationForKoFileDeclarationProviderTest.kt @@ -11,7 +11,7 @@ import org.amshove.kluent.assertSoftly import org.amshove.kluent.shouldBeEqualTo import org.junit.jupiter.api.Test -class KoObjectDeclarationForKoDeclarationProviderTest { +class KoObjectDeclarationForKoFileDeclarationProviderTest { @Test fun `object-has-no-declarations`() { // given diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/container/KoScopeCreatorCore.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/container/KoScopeCreatorCore.kt index 529b7c55ac..0b2ac2295a 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/container/KoScopeCreatorCore.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/core/container/KoScopeCreatorCore.kt @@ -9,50 +9,56 @@ import com.lemonappdev.konsist.core.ext.sep import com.lemonappdev.konsist.core.ext.toKoFile import com.lemonappdev.konsist.core.ext.toMacOsSeparator import com.lemonappdev.konsist.core.filesystem.PathProvider +import com.lemonappdev.konsist.core.provider.util.KoFileDeclarationProvider +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.runBlocking import java.io.File @Suppress("detekt.TooManyFunctions") internal class KoScopeCreatorCore : KoScopeCreator { - private val pathProvider: PathProvider by lazy { PathProvider.getInstance() } + override val projectRootPath: String by lazy { PathProvider.rootProjectPath } - private val projectKotlinFiles: List by lazy { File(pathProvider.rootProjectPath).toKoFiles() } - - override val projectRootPath: String by lazy { pathProvider.rootProjectPath } - - override fun scopeFromProject(moduleName: String?, sourceSetName: String?, ignoreBuildConfig: Boolean): KoScope { - val koFiles = getFiles(moduleName, sourceSetName, ignoreBuildConfig) - return KoScopeCore(koFiles) - } + override fun scopeFromProject(moduleName: String?, sourceSetName: String?, ignoreBuildConfig: Boolean): KoScope = + runBlocking { + val koFiles = getFiles(moduleName, sourceSetName, ignoreBuildConfig) + KoScopeCore(koFiles) + } override fun scopeFromModule(moduleName: String, vararg moduleNames: String): KoScope = scopeFromModules(setOf(moduleName) + moduleNames) - override fun scopeFromModules(moduleNames: Set): KoScope = - moduleNames - .flatMap { getFiles(it) } - .let { KoScopeCore(it) } + override fun scopeFromModules(moduleNames: Set): KoScopeCore = + runBlocking { + moduleNames + .flatMap { getFiles(it) } + .let { KoScopeCore(it) } + } - override fun scopeFromPackage(packagee: String, moduleName: String?, sourceSetName: String?): KoScope { - val koFiles = getFiles(moduleName, sourceSetName) - .withPackage(packagee) + override fun scopeFromPackage(packagee: String, moduleName: String?, sourceSetName: String?): KoScope = + runBlocking { + val koFiles = getFiles(moduleName, sourceSetName) + .withPackage(packagee) - return KoScopeCore(koFiles) - } + KoScopeCore(koFiles) + } override fun scopeFromSourceSet(sourceSetName: String, vararg sourceSetNames: String): KoScope = scopeFromSourceSets(setOf(sourceSetName) + sourceSetNames) override fun scopeFromSourceSets(sourceSetNames: Set): KoScope = - sourceSetNames - .flatMap { getFiles(sourceSetName = it) } - .let { KoScopeCore(it) } + runBlocking { + sourceSetNames + .flatMap { getFiles(sourceSetName = it) } + .let { KoScopeCore(it) } + } - private fun getFiles( + private suspend fun getFiles( moduleName: String? = null, sourceSetName: String? = null, ignoreBuildConfig: Boolean = true, - ): List { - val localProjectKotlinFiles = projectKotlinFiles + ): List = coroutineScope { + val localProjectKotlinFiles = KoFileDeclarationProvider + .getKoFileDeclarations() .filterNot { isBuildToolPath(it.path.toMacOsSeparator()) } .let { if (ignoreBuildConfig) { @@ -63,7 +69,7 @@ internal class KoScopeCreatorCore : KoScopeCreator { } if (moduleName == null && sourceSetName == null) { - return localProjectKotlinFiles + return@coroutineScope localProjectKotlinFiles } var pathPrefix = if (moduleName == ROOT_MODULE_NAME) { @@ -80,31 +86,33 @@ internal class KoScopeCreatorCore : KoScopeCreator { "$pathPrefix/src/.*" }.toMacOsSeparator() - return localProjectKotlinFiles + return@coroutineScope localProjectKotlinFiles .filter { it.path.toMacOsSeparator().matches(Regex(pathPrefix)) } } - override fun scopeFromProduction(moduleName: String?, sourceSetName: String?): KoScope { - sourceSetName?.let { - require(!isTestSourceSet(it)) { "Source set '$it' is a test source set, but it should be production source set." } - } - - val koFiles = getFiles(moduleName, sourceSetName) - .filterNot { isTestSourceSet(it.sourceSetName) } + override fun scopeFromProduction(moduleName: String?, sourceSetName: String?): KoScope = + runBlocking { + sourceSetName?.let { + require(!isTestSourceSet(it)) { "Source set '$it' is a test source set, but it should be production source set." } + } - return KoScopeCore(koFiles) - } + val koFiles = getFiles(moduleName, sourceSetName) + .filterNot { isTestSourceSet(it.sourceSetName) } - override fun scopeFromTest(moduleName: String?, sourceSetName: String?): KoScope { - sourceSetName?.let { - require(isTestSourceSet(it)) { "Source set '$it' is a production source set, but it should be test source set." } + KoScopeCore(koFiles) } - val koFiles = getFiles(moduleName, sourceSetName) - .filter { isTestSourceSet(it.sourceSetName) } + override fun scopeFromTest(moduleName: String?, sourceSetName: String?): KoScope = + runBlocking { + sourceSetName?.let { + require(isTestSourceSet(it)) { "Source set '$it' is a production source set, but it should be test source set." } + } - return KoScopeCore(koFiles) - } + val koFiles = getFiles(moduleName, sourceSetName) + .filter { isTestSourceSet(it.sourceSetName) } + + KoScopeCore(koFiles) + } /** * Get the scope of the paths obtaining the absolute path of it and, getting the files from that directory @@ -192,7 +200,8 @@ internal class KoScopeCreatorCore : KoScopeCreator { private fun isBuildOrTargetPath(path: String): Boolean { val gradleBuildDirectoryName = "build" val gradleRootBuildDirectoryRegex = Regex("$projectRootPath/$gradleBuildDirectoryName/.*".toMacOsSeparator()) - val gradleModuleBuildDirectoryRegex = Regex("$projectRootPath/.+/$gradleBuildDirectoryName/.*".toMacOsSeparator()) + val gradleModuleBuildDirectoryRegex = + Regex("$projectRootPath/.+/$gradleBuildDirectoryName/.*".toMacOsSeparator()) val mavenBuildDirectoryName = "target" val mavenRootBuildDirectoryRegex = Regex("$projectRootPath/$mavenBuildDirectoryName/.*".toMacOsSeparator()) @@ -236,10 +245,14 @@ internal class KoScopeCreatorCore : KoScopeCreator { .map { it.toKoFile() } .toList() - private fun getKoFiles(files: List) = projectKotlinFiles.filter { - files.any { file -> - file.path == it.path - } + private fun getKoFiles(files: List) = runBlocking { + KoFileDeclarationProvider + .getKoFileDeclarations() + .filter { + files.any { file -> + file.path == it.path + } + } } companion object { diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/filesystem/PathProvider.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/filesystem/PathProvider.kt index c8de26a58e..b057b89f24 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/filesystem/PathProvider.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/core/filesystem/PathProvider.kt @@ -3,10 +3,11 @@ package com.lemonappdev.konsist.core.filesystem import com.lemonappdev.konsist.core.exception.KoInternalException import java.io.File -class PathProvider( - private val koFileFactory: KoFileFactory, - private val projectRootDirProviderFactory: ProjectRootDirProviderFactory, -) { +object PathProvider { + private val koFileFactory = KoFileFactory() + private val pathVerifier = PathVerifier() + private val projectRootDirProviderFactory = ProjectRootDirProviderFactory(pathVerifier) + val rootProjectPath: String by lazy { val file = koFileFactory.create("") @@ -30,10 +31,4 @@ class PathProvider( .firstOrNull { it != null } ?: getProjectRootDirectory(file.absoluteFile.parentFile) } - - companion object { - private val pathVerifier = PathVerifier() - - fun getInstance() = PathProvider(KoFileFactory(), ProjectRootDirProviderFactory(pathVerifier)) - } } diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoModuleProviderCore.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoModuleProviderCore.kt index 5d56909b69..e4aeb46cdc 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoModuleProviderCore.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoModuleProviderCore.kt @@ -8,7 +8,6 @@ internal interface KoModuleProviderCore : KoModuleProvider, KoPathProviderCore, override val moduleName: String get() { val projectName = PathProvider - .getInstance() .rootProjectPath .substringAfterLast(sep) diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoPathProviderCore.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoPathProviderCore.kt index e8cb050a18..2d31000cba 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoPathProviderCore.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoPathProviderCore.kt @@ -18,7 +18,6 @@ internal interface KoPathProviderCore : KoPathProvider, KoBaseProviderCore { override val projectPath: String get() { val rootPathProvider = PathProvider - .getInstance() .rootProjectPath .toOsSeparator() diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/util/KoDeclarationProviderCoreUtil.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/util/KoDeclarationProviderCoreUtil.kt index 47cabcc8f9..957dcab8ca 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/util/KoDeclarationProviderCoreUtil.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/util/KoDeclarationProviderCoreUtil.kt @@ -169,18 +169,34 @@ internal object KoDeclarationProviderCoreUtil { containingDeclaration: KoBaseDeclaration, ): KoBaseDeclaration? = when { ktDeclaration is KtEnumEntry -> KoEnumConstantDeclarationCore.getInstance(ktDeclaration, containingDeclaration) - ktDeclaration is KtSecondaryConstructor -> KoSecondaryConstructorDeclarationCore.getInstance(ktDeclaration, containingDeclaration) - ktDeclaration is KtClass && !ktDeclaration.isInterface() -> KoClassDeclarationCore.getInstance(ktDeclaration, containingDeclaration) + ktDeclaration is KtSecondaryConstructor -> KoSecondaryConstructorDeclarationCore.getInstance( + ktDeclaration, + containingDeclaration, + ) + + ktDeclaration is KtClass && !ktDeclaration.isInterface() -> KoClassDeclarationCore.getInstance( + ktDeclaration, + containingDeclaration, + ) + ktDeclaration is KtClass && ktDeclaration.isInterface() -> KoInterfaceDeclarationCore.getInstance( ktDeclaration, containingDeclaration, ) - ktDeclaration is KtObjectDeclaration -> KoObjectDeclarationCore.getInstance(ktDeclaration, containingDeclaration) + ktDeclaration is KtObjectDeclaration -> KoObjectDeclarationCore.getInstance( + ktDeclaration, + containingDeclaration, + ) + ktDeclaration is KtProperty -> KoPropertyDeclarationCore.getInstance(ktDeclaration, containingDeclaration) ktDeclaration is KtFunction -> KoFunctionDeclarationCore.getInstance(ktDeclaration, containingDeclaration) ktDeclaration is KtTypeAlias -> KoTypeAliasDeclarationCore.getInstance(ktDeclaration, containingDeclaration) - ktDeclaration is KtAnonymousInitializer -> KoInitBlockDeclarationCore.getInstance(ktDeclaration, containingDeclaration) + ktDeclaration is KtAnonymousInitializer -> KoInitBlockDeclarationCore.getInstance( + ktDeclaration, + containingDeclaration, + ) + else -> null } diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/util/KoFileDeclarationProvider.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/util/KoFileDeclarationProvider.kt new file mode 100644 index 0000000000..5ff0b0d741 --- /dev/null +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/util/KoFileDeclarationProvider.kt @@ -0,0 +1,79 @@ +package com.lemonappdev.konsist.core.provider.util + +import com.lemonappdev.konsist.api.declaration.KoFileDeclaration +import com.lemonappdev.konsist.core.ext.isKotlinFile +import com.lemonappdev.konsist.core.ext.toKoFile +import com.lemonappdev.konsist.core.filesystem.PathProvider +import kotlinx.coroutines.Deferred +import kotlinx.coroutines.DelicateCoroutinesApi +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.async +import kotlinx.coroutines.awaitAll +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.launch +import kotlinx.coroutines.sync.Mutex +import kotlinx.coroutines.sync.withLock +import kotlinx.coroutines.withContext +import java.io.File + +internal object KoFileDeclarationProvider { + private val projectRootDir: File = File(PathProvider.rootProjectPath) + + private val mutex: Mutex = Mutex() + + @Volatile + private var createKoFilesDeclarationDeferred: Deferred>? = null + + init { + check(projectRootDir.exists()) { "Directory does not exist: ${projectRootDir.absolutePath}" } + check(projectRootDir.isDirectory) { "Project root directory is a File ${projectRootDir.absolutePath}" } + + @OptIn(DelicateCoroutinesApi::class) + GlobalScope.launch { + withContext(Dispatchers.IO) { + getKoFileDeclarations() + } + } + } + + /** + * Retrieves a list of [KoFileDeclaration]s asynchronously from the project's root directory. + * This function scans the directory for Kotlin files and parses them to obtain list of KoFileDeclaration. + * + * The parsing operations are performed concurrently. + * + * Threading Strategy: + * Ensures thread-safe initialization of a single deferred operation to parse all Kotlin files, using a mutex to + * guard against concurrent initializations. + * File walking and parsing operations, optimizing for I/O operations are performed concurrently across + * multiple threads. + * + * e.g. + * 1. getKoFileDeclarations started at Thread 1 - start file parsing + * 2. getKoFileDeclarations started at Thread 2 - file parsing in progress, wait for it to complete + * 3. Parse Kotlin files in parallel + * 4. getKoFileDeclarations started at Thread 1 completes + * 5. getKoFileDeclarations started at Thread 2 completes + * + * @return A list of [KoFileDeclaration]s representing the parsed Kotlin files. + * @throws Exception if there's an issue accessing the file system or parsing the files. + */ + suspend fun getKoFileDeclarations(): List = coroutineScope { + val currentDeferred: Deferred> = mutex.withLock { + createKoFilesDeclarationDeferred ?: async(Dispatchers.IO) { + projectRootDir.walk() + .filter { it.isKotlinFile } + .map { async { parseKotlinFile(it) } } + .toList() + .awaitAll() + }.also { createKoFilesDeclarationDeferred = it } + } + + currentDeferred.await() + } + + private suspend fun parseKotlinFile(it: File): KoFileDeclaration = coroutineScope { + async { it.toKoFile() }.await() + } +} diff --git a/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/KoDeclarationProviderListExtTest.kt b/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/KoFileDeclarationProviderListExtTest.kt similarity index 99% rename from lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/KoDeclarationProviderListExtTest.kt rename to lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/KoFileDeclarationProviderListExtTest.kt index bded176f89..abcaef44fc 100644 --- a/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/KoDeclarationProviderListExtTest.kt +++ b/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/KoFileDeclarationProviderListExtTest.kt @@ -13,7 +13,7 @@ import io.mockk.mockk import org.amshove.kluent.shouldBeEqualTo import org.junit.jupiter.api.Test -class KoDeclarationProviderListExtTest { +class KoFileDeclarationProviderListExtTest { @Test fun `declarations() returns declarations from all declarations`() { // given diff --git a/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/provider/KoDeclarationProviderExtTest.kt b/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/provider/KoFileDeclarationProviderExtTest.kt similarity index 98% rename from lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/provider/KoDeclarationProviderExtTest.kt rename to lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/provider/KoFileDeclarationProviderExtTest.kt index 81809b1333..1ce8048678 100644 --- a/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/provider/KoDeclarationProviderExtTest.kt +++ b/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/provider/KoFileDeclarationProviderExtTest.kt @@ -15,7 +15,7 @@ import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments.arguments import org.junit.jupiter.params.provider.MethodSource -class KoDeclarationProviderExtTest { +class KoFileDeclarationProviderExtTest { // We add these interfaces to simulate declarations that different providers implement. private interface TestDeclarationWithModifierProvider : KoBaseDeclaration, KoModifierProvider private interface TestDeclarationWithoutModifierProvider : KoBaseDeclaration, KoAnnotationProvider