View Javadoc
1   package org.jastacry.test;
2   
3   import org.jastacry.layer.Layer;
4   
5   import com.tngtech.archunit.core.importer.ImportOption;
6   import com.tngtech.archunit.junit.AnalyzeClasses;
7   import com.tngtech.archunit.junit.ArchTest;
8   import com.tngtech.archunit.lang.ArchRule;
9   import com.tngtech.archunit.lang.syntax.ArchRuleDefinition;
10  
11  import static com.tngtech.archunit.library.GeneralCodingRules.NO_CLASSES_SHOULD_THROW_GENERIC_EXCEPTIONS;
12  import static com.tngtech.archunit.library.GeneralCodingRules.NO_CLASSES_SHOULD_ACCESS_STANDARD_STREAMS;
13  import static com.tngtech.archunit.library.GeneralCodingRules.NO_CLASSES_SHOULD_USE_JAVA_UTIL_LOGGING;
14  import static com.tngtech.archunit.library.GeneralCodingRules.NO_CLASSES_SHOULD_USE_JODATIME;
15  
16  /**
17   * Test of Architectural stuff.
18   *
19   * @author Kai Kretschmann
20   *
21   */
22  @AnalyzeClasses(
23          packages = "org.jastacry", 
24          importOptions = 
25              ImportOption.DoNotIncludeTests.class
26      )
27  public class TestArch
28  {
29  
30      @ArchTest
31      public static final ArchRule inheritanceRule = ArchRuleDefinition.classes()
32              .that().implement(Layer.class)
33              .should().haveSimpleNameEndingWith("Layer");
34  
35      @ArchTest
36      public static final ArchRule noJavaUtilLoggin = NO_CLASSES_SHOULD_USE_JAVA_UTIL_LOGGING;
37  
38      @ArchTest
39      public static final ArchRule noStdStreams = NO_CLASSES_SHOULD_ACCESS_STANDARD_STREAMS;
40  
41      @ArchTest
42      public static final ArchRule noGenericExceptions = NO_CLASSES_SHOULD_THROW_GENERIC_EXCEPTIONS;
43  
44      @ArchTest
45      public static final ArchRule noJodaTime = NO_CLASSES_SHOULD_USE_JODATIME;
46  }