-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The term `ArchRules` is misleading, because it suggests that the class collects instances of `ArchRule`, while in fact it looks for members annotated with `@ArchTest`. This becomes particular clear, if you look at method declarations like `@ArchTest static void rule_method(JavaClasses classes) {..}`. I have thus introduced `ArchTests.in(someClass)` as a new version that makes this clearer (including some Javadoc this time) and kept the old `ArchRules` as a deprecated version for now to be backwards compatible. I have duplicated quite some code (like whole test classes) and not unified much of the additional complexity by having `ArchTests` as well as `ArchRules`, since this is only temporary and we can kick it out in the near future. Resolves: #525 Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
- Loading branch information
Showing
27 changed files
with
615 additions
and
118 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
8 changes: 4 additions & 4 deletions
8
...example-junit5/src/test/java/com/tngtech/archunit/exampletest/junit5/RuleLibraryTest.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 |
---|---|---|
@@ -1,19 +1,19 @@ | ||
package com.tngtech.archunit.exampletest.junit5; | ||
|
||
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.junit.ArchTests; | ||
|
||
@ArchTag("example") | ||
@AnalyzeClasses(packages = "com.tngtech.archunit.example.layers") | ||
class RuleLibraryTest { | ||
@ArchTest | ||
static final ArchRules LIBRARY = ArchRules.in(RuleSetsTest.class); | ||
static final ArchTests LIBRARY = ArchTests.in(RuleSetsTest.class); | ||
|
||
@ArchTest | ||
static final ArchRules FURTHER_CODING_RULES = ArchRules.in(CodingRulesTest.class); | ||
static final ArchTests FURTHER_CODING_RULES = ArchTests.in(CodingRulesTest.class); | ||
|
||
@ArchTest | ||
static final ArchRules SLICES_ISOLATION_RULES = ArchRules.in(SlicesIsolationTest.class); | ||
static final ArchTests SLICES_ISOLATION_RULES = ArchTests.in(SlicesIsolationTest.class); | ||
} |
6 changes: 3 additions & 3 deletions
6
...le/example-junit5/src/test/java/com/tngtech/archunit/exampletest/junit5/RuleSetsTest.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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
package com.tngtech.archunit.exampletest.junit5; | ||
|
||
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.junit.ArchTests; | ||
|
||
@ArchTag("example") | ||
@AnalyzeClasses(packages = "com.tngtech.archunit.example.layers") | ||
class RuleSetsTest { | ||
@ArchTest | ||
private final ArchRules CODING_RULES = ArchRules.in(CodingRulesTest.class); | ||
private final ArchTests CODING_RULES = ArchTests.in(CodingRulesTest.class); | ||
|
||
@ArchTest | ||
private final ArchRules NAMING_CONVENTION_RULES = ArchRules.in(NamingConventionTest.class); | ||
private final ArchTests NAMING_CONVENTION_RULES = ArchTests.in(NamingConventionTest.class); | ||
} |
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
Oops, something went wrong.