-
-
Save andres-sacco/5a0e194e810c3c99840d047349da2999 to your computer and use it in GitHub Desktop.
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