ArchUnit

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

  • 所有者: TNG/ArchUnit
  • 平台:
  • 许可证: Apache License 2.0
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Build Status
Maven Central
License

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
testCompile 'com.tngtech.archunit:archunit:0.13.0'
Maven
<dependency>
    <groupId>com.tngtech.archunit</groupId>
    <artifactId>archunit</artifactId>
    <version>0.13.0</version>
    <scope>test</scope>
</dependency>

Create a test

import com.tngtech.archunit.core.domain.JavaClasses;
import com.tngtech.archunit.core.importer.ClassFileImporter;
import com.tngtech.archunit.lang.ArchRule;

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

public 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.

主要指标

概览
名称与所有者TNG/ArchUnit
主编程语言Java
编程语言Java (语言数: 2)
平台
许可证Apache License 2.0
所有者活动
创建于2017-04-21 08:39:20
推送于2025-06-17 06:06:56
最后一次提交
发布数43
最新版本名称v1.3.2 (发布于 )
第一版名称v0.4.0 (发布于 )
用户参与
星数3.4k
关注者数51
派生数316
提交数2.5k
已启用问题?
问题数590
打开的问题数128
拉请求数550
打开的拉请求数17
关闭的拉请求数264
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?