forked from TNG/ArchUnit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves TNG#282 Signed-off-by: Daniel Shuy <[email protected]>
- Loading branch information
1 parent
16f3561
commit 4d6bbef
Showing
14 changed files
with
618 additions
and
3 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
67 changes: 67 additions & 0 deletions
67
.../junit5/engine/src/test/java/com/tngtech/archunit/junit/testexamples/ComplexMetaTags.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,67 @@ | ||
package com.tngtech.archunit.junit.testexamples; | ||
|
||
import com.tngtech.archunit.core.domain.JavaClasses; | ||
import com.tngtech.archunit.junit.AnalyzeClasses; | ||
import com.tngtech.archunit.junit.ArchRules; | ||
import com.tngtech.archunit.junit.ArchTag; | ||
import com.tngtech.archunit.junit.ArchTest; | ||
import com.tngtech.archunit.lang.ArchRule; | ||
|
||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.*; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
@ComplexMetaTags.LibraryTag | ||
@AnalyzeClasses | ||
public class ComplexMetaTags { | ||
public static final String FIELD_RULE_NAME = "field_rule"; | ||
public static final String METHOD_RULE_NAME = "method_rule"; | ||
|
||
@RulesTag | ||
@ArchTest | ||
static final ArchRules classWithMetaTag = ArchRules.in(TestClassWithMetaTag.class); | ||
|
||
@RulesTag | ||
@ArchTest | ||
static final ArchRules classWithMetaTags = ArchRules.in(TestClassWithMetaTags.class); | ||
|
||
@FieldTag | ||
@ArchTest | ||
static final ArchRule field_rule = RuleThatFails.on(UnwantedClass.class); | ||
|
||
@MethodTag | ||
@ArchTest | ||
static void method_rule(JavaClasses classes) { | ||
} | ||
|
||
@Inherited | ||
@Retention(RUNTIME) | ||
@Target({TYPE, METHOD, FIELD}) | ||
@ArchTag("library-meta-tag") | ||
@interface LibraryTag { | ||
} | ||
|
||
@Inherited | ||
@Retention(RUNTIME) | ||
@Target({TYPE, METHOD, FIELD}) | ||
@ArchTag("rules-meta-tag") | ||
@interface RulesTag { | ||
} | ||
|
||
@Inherited | ||
@Retention(RUNTIME) | ||
@Target({TYPE, METHOD, FIELD}) | ||
@ArchTag("field-meta-tag") | ||
@interface FieldTag { | ||
} | ||
|
||
@Inherited | ||
@Retention(RUNTIME) | ||
@Target({TYPE, METHOD, FIELD}) | ||
@ArchTag("method-meta-tag") | ||
@interface MethodTag { | ||
} | ||
} |
Oops, something went wrong.