1

Add more architecture tests

This commit is contained in:
XXNitram
2020-03-23 16:45:57 +01:00
parent c7445d8dee
commit 90e0a1ff52

View File

@ -4,6 +4,7 @@ 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;
import mops.gruppen2.domain.exception.EventException;
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes;
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;
@ -44,6 +45,16 @@ public class DomainTest {
@ArchTest
public static final ArchRule classesThatHaveExceptionInNameShouldBeAssignableToExceptionClass = classes()
.that().haveSimpleNameEndingWith("Exception")
.should().beAssignableTo(Exception.class);
.should().beAssignableTo(EventException.class);
@ArchTest
public static final ArchRule classesInDtoPackageShouldHaveDtoInName = classes()
.that().resideInAPackage("..domain.dto..")
.should().haveSimpleNameEndingWith("DTO");
@ArchTest
public static final ArchRule dtoClassesShouldBeInDtoPackage = classes()
.that().haveSimpleNameEndingWith("DTO")
.should().resideInAPackage("..domain.dto..");
}