-
-
Save andres-sacco/d6395e88a6bbb2135ad391ab8cce49ba to your computer and use it in GitHub Desktop.
Model 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.almundo.api.flights.cvc.architecture.CustomArchConditions.HAVE_EQUALS_AND_HASH_CODE; | |
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes; | |
import com.tngtech.archunit.core.importer.ImportOption; | |
import com.tngtech.archunit.junit.AnalyzeClasses; | |
import com.tngtech.archunit.junit.ArchTest; | |
import com.tngtech.archunit.lang.ArchRule; | |
@AnalyzeClasses(packages = "com.example.archunit", importOptions = ImportOption.DoNotIncludeTests.class) | |
class ModelRulesTest { | |
@ArchTest | |
static final ArchRule classesShouldOverrideEqualsAndHashCode = classes().that() | |
.resideInAnyPackage("com.example.archunit.model") | |
.and().areNotMemberClasses() | |
.should(HAVE_EQUALS_AND_HASH_CODE) | |
.because("Model classes should override equals and hashCode methods"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment