/CommonRules.java Secret
Last active
January 16, 2021 00:27
Common rules
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
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.methods; | |
import java.util.Arrays; | |
import com.tngtech.archunit.lang.ArchRule; | |
class CommonRules { | |
static ArchRule methodsShouldBePublicRule(String... packageNames) { | |
return methods() | |
.that().areDeclaredInClassesThat() | |
.resideInAnyPackage(packageNames) | |
.should().bePublic() | |
.because("Public methods are only allowed in " + Arrays.toString(packageNames)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment