• Stars
    star
    3,064
  • Rank 14,213 (Top 0.3 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 7 years ago
  • Updated 1 day ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

CI 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
testImplementation 'com.tngtech.archunit:archunit:1.3.0'
Maven
<dependency>
    <groupId>com.tngtech.archunit</groupId>
    <artifactId>archunit</artifactId>
    <version>1.3.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.

More Repositories

1

boost-python-examples

Some examples for the use of boost::python
C++
823
star
2

ArchUnitNET

A C# architecture test library to specify and assert architecture rules in C# for automated testing.
C#
789
star
3

ArchUnit-Examples

Examples for ArchUnit (A Java architecture test library, to specify and assert architecture rules in plain Java)
Java
534
star
4

JGiven

Behavior-Driven Development in plain Java
Java
431
star
5

junit-dataprovider

A TestNG like dataprovider runner for JUnit with many additional features
Java
243
star
6

virtual-office

Virtual Office gives you transparency on what Zoom.us rooms are currently occupied and who is present
TypeScript
122
star
7

keycloak-mock

A Java library to test REST endpoints secured by Keycloak via OpenID connect.
Java
110
star
8

ngqp

Declaratively synchronize form controls with the URL
TypeScript
80
star
9

next-generation-scrum-poker

Prototype for a new Scrum Poker
TypeScript
46
star
10

please-cli

An AI helper for creating CLI commands
Shell
42
star
11

cumulus

Cumulus. Threat modeling the Clouds.
TeX
26
star
12

ApiCenter

A repository for all your API specifications
TypeScript
25
star
13

momo-scheduler

A scheduler that persists jobs in MongoDB
TypeScript
16
star
14

gs-rs

Rust
15
star
15

svnfiltereddump

A tool to extract parts from Subversion repositories
Python
14
star
16

flink-connector-email

IMAP / SMTP connectors for Apache Flinkยฎ
Java
13
star
17

ngx-structurals

Structural utility directives for Angular
TypeScript
13
star
18

mustard-cli

A command line interface for bitbucket to review, comment and approve pull requests
C++
12
star
19

sinon-helpers

Create easily configurable sinon stubs that mimic constructors and keep track of their instances
JavaScript
12
star
20

jgiven-intellij-plugin

IntelliJ Plugin for JGiven
Kotlin
11
star
21

openpgp-validation-server

Automated Validation of OpenPGP Keys
Go
7
star
22

jiradeps

Graphically assess the dependencies of your Jira stories
Python
6
star
23

property-loader

Original PropertyLoader reworked
Java
6
star
24

value-provider

Java
5
star
25

rest-demo-jersey

Spring-boot and Jersey based REST service showing the integration of rest-schemagen.
Java
4
star
26

please-pwsh

An AI helper for creating CLI commands in Powershell
PowerShell
4
star
27

NextGenerationTranslatorBackend

A translation backend for AI translation models
Python
3
star
28

homebrew-please

A Homebrew tap for the Please CLI
Ruby
2
star
29

apt-please

2
star
30

karma-child-process

JavaScript
2
star
31

xtab-converter

Convert existing dbunit XLS files to XML data sets
Java
1
star
32

TNG

1
star
33

SnapToJsClipper

JavaScript
1
star