Package com.tngtech.archunit.junit
Annotation Type AnalyzeClasses
-
@Testable @Target(TYPE) @Retention(RUNTIME) @PublicAPI(usage=ACCESS) public @interface AnalyzeClassesSpecifies which packages/locations should be scanned and tested when running a JUnit 5 test.
To ignore certain classes (e.g. classes in test scope) seeimportOptions(), in particularImportOption.DoNotIncludeTestsandImportOption.DoNotIncludeJars.
When checking rules, it is important to remember that all relevant information/classes need to be imported for the rules to work. For example, if class A accesses class B and class B extends class C, but class B is not imported, then a rule checking for no accesses to classes assignable to C will not fail, since ArchUnit does not know about the details of class B, but only simple information like the fully qualified name. For information how to configure the import and resolution behavior of missing classes, compareClassFileImporter.- See Also:
ClassFileImporter
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description CacheModecacheModeControls, ifJavaClassesshould be cached by location, to be reused between several test classes, or just within the same class.java.lang.Class<? extends com.tngtech.archunit.core.importer.ImportOption>[]importOptionsAllows to filter the class import.java.lang.Class<? extends LocationProvider>[]locationsjava.lang.String[]packagesjava.lang.Class<?>[]packagesOf
-
-
-
-
locations
java.lang.Class<? extends LocationProvider>[] locations
- Returns:
- Implementations of
LocationProvider. Allows to completely customize the sources, where classes are imported from.
- Default:
- {}
-
-
-
importOptions
java.lang.Class<? extends com.tngtech.archunit.core.importer.ImportOption>[] importOptions
Allows to filter the class import. The supplied types will be instantiated and used to create theImportOptionspassed to theClassFileImporter. Considering caching, compare the notes onImportOption.- Returns:
- The types of
ImportOptionto use for the import
- Default:
- {}
-
-