assertOnlyBeAccessedByAnyPackage

fun List<ClassDeclaration>.assertOnlyBeAccessedByAnyPackage(vararg packagePatterns: String, allClasses: List<ClassDeclaration> = Konture.projectGraph.getAllModules().flatMap { it.classes })

Asserts that the selected classes are only accessed by classes residing in packages matching the specified patterns.

Example:

repositories.assertOnlyBeAccessedByAnyPackage("..domain..", "..data..")

Parameters

packagePatterns

Package wildcard patterns representing allowed accessing classes.

allClasses

The complete collection of class declarations used for dependency resolution. Defaults to all classes in the loaded project graph.

Throws

if any unauthorized class accesses any of the target classes.


fun KontureScope.assertOnlyBeAccessedByAnyPackage(vararg packagePatterns: String, allClasses: List<ClassDeclaration> = Konture.projectGraph.getAllModules().flatMap { it.classes })

Asserts that the selected classes in the scope are only accessed by classes residing in packages matching the specified patterns.

Parameters

packagePatterns

Package wildcard patterns representing allowed accessing classes.

allClasses

The complete collection of class declarations used for dependency resolution. Defaults to all classes in the loaded project graph.

Throws

if any unauthorized class accesses any of the target classes.