-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable
@AnalyzeClasses
annotation to be used as meta annotation
so far users are forced to repeat `@AnalyzeClasses` annotation an every test class. This cause additional maintenance overhead when common properties (e.g. package structure) changes. To support the DRY approach, `@AnalzyeClasses` annotation can now be used as meta annotation. Resolves: #182 Signed-off-by: Mathze <270275+mathze@users.noreply.github.com>
- Loading branch information
1 parent
05676d2
commit 9e90a3b
Showing
9 changed files
with
223 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...ch/archunit/junit/internal/testexamples/TestClassWithMetaAnnotationForAnalyzeClasses.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.tngtech.archunit.junit.internal.testexamples; | ||
|
||
import java.lang.annotation.Retention; | ||
|
||
import com.tngtech.archunit.junit.AnalyzeClasses; | ||
import com.tngtech.archunit.junit.ArchTest; | ||
import com.tngtech.archunit.lang.ArchRule; | ||
|
||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
@TestClassWithMetaAnnotationForAnalyzeClasses.MetaAnalyzeClasses | ||
public class TestClassWithMetaAnnotationForAnalyzeClasses { | ||
|
||
@ArchTest | ||
public static final ArchRule rule_in_class_with_meta_analyze_class_annotation = RuleThatFails.on(UnwantedClass.class); | ||
|
||
@Retention(RUNTIME) | ||
@AnalyzeClasses(wholeClasspath = true) | ||
public @interface MetaAnalyzeClasses { | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...it/src/main/java/com/tngtech/archunit/junit/internal/ArchTestInitializationException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.