Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/TNG/ArchUnit
A Java architecture test library, to specify and assert architecture rules in plain Java
https://github.com/TNG/ArchUnit
Last synced: about 2 months ago
JSON representation
A Java architecture test library, to specify and assert architecture rules in plain Java
- Host: GitHub
- URL: https://github.com/TNG/ArchUnit
- Owner: TNG
- License: apache-2.0
- Created: 2017-04-21T08:39:20.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-10-15T06:57:20.000Z (about 2 months ago)
- Last Synced: 2024-10-19T17:44:25.692Z (about 2 months ago)
- Language: Java
- Homepage: http://archunit.org
- Size: 16.1 MB
- Stars: 3,202
- Watchers: 51
- Forks: 290
- Open Issues: 143
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-modernization - ArchUnit
- awesome-ccamel - TNG/ArchUnit - A Java architecture test library, to specify and assert architecture rules in plain Java (Java)
- awesome-list - TNG/ArchUnit - A Java architecture test library, to specify and assert architecture rules in plain Java (Java)
- awesome-java - ArchUnit - Test library for specifying and asserting architecture rules. (Projects / Architecture)
README
[![CI](https://github.com/TNG/ArchUnit/actions/workflows/build.yml/badge.svg)](https://github.com/TNG/ArchUnit/actions/workflows/build.yml?query=branch%3Amain++)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.tngtech.archunit/archunit/badge.svg)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.tngtech.archunit%22%20)
[![License](https://img.shields.io/github/license/TNG/ArchUnit.svg)](https://github.com/TNG/ArchUnit/blob/main/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
```
testImplementation 'com.tngtech.archunit:archunit:1.3.0'
```###### Maven
```
com.tngtech.archunit
archunit
1.3.0
test```
#### Create a test
```java
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](ArchUnit-API.gif)## Where to look next
For further information, check out the user guide at [http://archunit.org](http://archunit.org)
or test examples for the current release at
[ArchUnit Examples](https://github.com/TNG/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:
* ASM (http://asm.ow2.org), under BSD Licence
* Google Guava (https://github.com/google/guava), under Apache License 2.0All licenses for ArchUnit and redistributed libraries can be found within the [licenses](licenses) folder.