Created
October 12, 2020 20:59
-
-
Save BenjaminKlatt/2deb2c08e2efa716ed194e2cc00c403e to your computer and use it in GitHub Desktop.
ArchUnit Vorgefertigte Team Regeln
This file contains hidden or 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
package de.viadee.architecture.archunit.rules; | |
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes; | |
import org.springframework.web.bind.annotation.RestController; | |
import com.tngtech.archunit.lang.ArchRule; | |
public class TeamArchRules { | |
/** Architecture Rule for REST controller conventions */ | |
public static ArchRule CONTROLLERS_SHOULD_BE_SUFFIXED_AND_LOCATED = | |
classes() | |
.that().areAnnotatedWith(RestController.class) | |
.should().haveSimpleNameEndingWith("Controller") | |
.andShould().resideInAPackage("..controller..") | |
.because("controllers must be easy to find and identify"); | |
} |
This file contains hidden or 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
package de.viadee.architecture.archunit.architecture; | |
import com.tngtech.archunit.junit.AnalyzeClasses; | |
import com.tngtech.archunit.junit.ArchTest; | |
import com.tngtech.archunit.lang.ArchRule; | |
import de.viadee.architecture.archunit.rules.TeamArchRules; | |
@AnalyzeClasses(packages = "de.viadee.architecture.archunit") | |
public class TeamRulesTest { | |
@ArchTest | |
private static ArchRule controllers_should_be_suffixed = TeamArchRules.CONTROLLERS_SHOULD_BE_SUFFIXED_AND_LOCATED; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment