An open API service indexing awesome lists of open source software.

https://github.com/enofex/taikai

Taikai is an extension of the popular ArchUnit library, offering a comprehensive suite of predefined rules tailored for various technologies.
https://github.com/enofex/taikai

architecture-tests archunit java junit5 logging spring spring-boot testing

Last synced: about 2 months ago
JSON representation

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

Awesome Lists containing this project

README

        







# Taikai

Taikai extends the capabilities of the popular ArchUnit library by offering a comprehensive suite of predefined rules tailored for various technologies. It simplifies the enforcement of architectural constraints and best practices in your codebase, ensuring consistency and quality across your projects.

## Maven Usage

Add Taikai as a dependency in your `pom.xml`:

```xml

com.enofex
taikai
${taikai.version}
test

```

Replace `${taikai.version}` with the appropriate version defined in your project. Ensure that the required dependencies like ArchUnit are already declared.

## Gradle Usage

Add Taikai as a dependency in your `build.gradle` file:

```groovy
testImplementation "com.enofex:taikai:${taikaiVersion}"
```

Replace `${taikaiVersion}` with the appropriate version defined in your project. Ensure that the required dependencies like ArchUnit are already declared.

## JUnit 5 Example Test

Here's an example demonstrating the usage of some Taikai rules with JUnit 5. Customize rules as needed using `TaikaiRule.of()`.

```java
@Test
void shouldFulfillConstraints() {
Taikai.builder()
.namespace("com.enofex.taikai")
.java(java -> java
.noUsageOfDeprecatedAPIs()
.methodsShouldNotDeclareGenericExceptions()
.utilityClassesShouldBeFinalAndHavePrivateConstructor()
.imports(imports -> imports
.shouldHaveNoCycles()
.shouldNotImport("..shaded..")
.shouldNotImport("org.junit.."))
.naming(naming -> naming
.classesShouldNotMatch(".*Impl")
.methodsShouldNotMatch("^(?!foo$|bar$).*")
.fieldsShouldNotMatch(".*(List|Set|Map)$")
.fieldsShouldMatch("com.enofex.taikai.Matcher", "matcher")
.constantsShouldFollowConventions()
.interfacesShouldNotHavePrefixI()))
.logging(logging -> logging
.loggersShouldFollowConventions(Logger.class, "logger", List.of(PRIVATE, FINAL)))
.test(test -> test
.junit5(junit5 -> junit5
.classesShouldNotBeAnnotatedWithDisabled()
.methodsShouldNotBeAnnotatedWithDisabled()))
.spring(spring -> spring
.noAutowiredFields()
.boot(boot -> boot
.springBootApplicationShouldBeIn("com.enofex.taikai"))
.configurations(configuration -> configuration
.namesShouldEndWithConfiguration())
.controllers(controllers -> controllers
.shouldBeAnnotatedWithRestController()
.namesShouldEndWithController()
.shouldNotDependOnOtherControllers()
.shouldBePackagePrivate())
.services(services -> services
.shouldBeAnnotatedWithService()
.shouldNotDependOnControllers()
.namesShouldEndWithService())
.repositories(repositories -> repositories
.shouldBeAnnotatedWithRepository()
.shouldNotDependOnServices()
.namesShouldEndWithRepository()))
.addRule(TaikaiRule.of(...)) // Add custom ArchUnit rule here
.build()
.check();
}
```

## User Guide

Explore the complete [documentation](https://enofex.github.io/taikai) for comprehensive information on all available rules.

## Contributing

Interested in contributing? Check out our [Contribution Guidelines](https://github.com/enofex/taikai/blob/main/CONTRIBUTING.md) for details on how to get involved. Note, that we expect everyone to follow the [Code of Conduct](https://github.com/enofex/taikai/blob/main/CODE_OF_CONDUCT.md).

### What you will need

* Git
* Java 17 or higher

### Get the Source Code

Clone the repository

```shell
git clone [email protected]:enofex/taikai.git
cd taikai
```

### Build the code

To compile, test, and build

```shell
./mvnw clean package -B
```

## Backers

The Open Source Community







## Website

Visit the [Taikai](https://enofex.github.io/taikai/) Website for general information and documentation.