Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ taikai Public

Taikai is an extension of the popular ArchUnit library, offering a comprehensive suite of predefined rules tailored for various technologies.

License

Notifications You must be signed in to change notification settings

enofex/taikai

Repository files navigation

maven workflow

Taikai

Taikai is a powerful extension of the popular ArchUnit library, offering a comprehensive suite of predefined rules tailored for various technologies. It simplifies the process of enforcing architectural constraints and best practices in your codebase, ensuring consistency and quality across your projects.

Maven Usage

<dependency>
  <groupId>com.enofex</groupId>
  <artifactId>taikai</artifactId>
  <version>${taikai.version}</version>
  <scope>test</scope>
</dependency>

The ${taikai.version} property should be defined as a property in your Maven project to specify the version. The library requires that the necessary dependencies in this case ArchUnit is already declared.

JUnit 5 Example test

@Test
void shouldFulfilConstrains() {
  Taikai.builder()
      .namespace("com.enofex.taikai")
      .spring(spring -> spring
          .noAutowiredFields()
          .boot(boot -> boot
              .springBootApplicationShouldBeIn("com.enofex.taikai"))
          .configurations(configuration -> configuration
              .namesShouldEndWithConfiguration()
              .namesShouldMatch("regex"))
          .controllers(controllers -> controllers
              .shouldBeAnnotatedWithRestController()
              .namesShouldEndWithController()
              .namesShouldMatch("regex")
              .shouldNotDependOnOtherControllers()
              .shouldBePackagePrivate())
          .services(services -> services
              .shouldBeAnnotatedWithService()
              .namesShouldMatch("regex")
              .namesShouldEndWithService())
          .repositories(repositories -> repositories
              .shouldBeAnnotatedWithRepository()
              .namesShouldMatch("regex")
              .namesShouldEndWithRepository()))
      .test(test -> test
          .junit5(junit5 -> junit5
              .classesShouldNotBeAnnotatedWithDisabled()
              .methodsShouldNotBeAnnotatedWithDisabled()))
      .java(java -> java
          .noUsageOfDeprecatedAPIs()
          .methodsShouldNotThrowGenericException()
          .utilityClassesShouldBeFinalAndHavePrivateConstructor()
          .imports(imports -> imports
              .shouldHaveNoCycles()
              .shouldNotImport("..shaded..")
              .shouldNotImport("org.junit.."))
          .naming(naming -> naming
              .classesShouldNotMatch(".*Impl")
              .interfacesShouldNotHavePrefixI()))
      .build()
      .check();
}

User Guide

Please refer to the complete documentation for detailed information.

Contributing

If you want to contribute to this project, then follow please these instructions.

About

Taikai is an extension of the popular ArchUnit library, offering a comprehensive suite of predefined rules tailored for various technologies.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages