TNG/ArchUnit

Name: ArchUnit

Owner: TNG Technology Consulting GmbH

Description: A Java architecture test library, to specify and assert architecture rules in plain Java

Created: 2017-04-21 08:39:20.0

Updated: 2018-05-24 19:57:40.0

Pushed: 2018-05-23 18:05:41.0

Homepage: http://archunit.org

Size: 5863

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build Status Maven Central License

ArchUnit

ArchUnit is a free, simple and extensible library for checking the architecture of your Java code. That is, ArchUnit can check dependencies between packages and classes, layers and slices, check for cyclic dependencies and more. It does so by analyzing given Java bytecode, importing all classes into a Java code structure. ArchUnit's main focus is to automatically test architecture and coding rules, using any plain Java unit testing framework.

An Example
Add the Maven Central dependency to your project Gradle
Compile 'com.tngtech.archunit:archunit:0.8.0'
Maven
endency>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit</artifactId>
<version>0.8.0</version>
<scope>test</scope>
pendency>
Create a test
rt com.tngtech.archunit.core.domain.JavaClasses;
rt com.tngtech.archunit.core.importer.ClassFileImporter;
rt com.tngtech.archunit.lang.ArchRule;

rt static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes;

ic class MyArchitectureTest {
@Test
public void some_architecture_rule() {
    JavaClasses importedClasses = new ClassFileImporter().importPackages("com.myapp");

    ArchRule rule = classes()... // see next section

    rule.check(importedClasses);
}

Let the API guide you

ArchUnit Fluent API

Where to look next

For further information, check out the user guide at http://archunit.org or test examples for the current release at ArchUnit Examples.

License

ArchUnit is published under the Apache License 2.0, see http://www.apache.org/licenses/LICENSE-2.0 for details.

It redistributes some third party libraries:

All licenses for ArchUnit and redistributed libraries can be found within the licenses folder.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.