Giter Club home page Giter Club logo

archunit-junit5-kotlin's Introduction

Generic Architecture Tests with ArchUnit

This repository shows generic examples for architecture tests using ArchUnit. The tests are written in Kotlin using the Junit5 testing framework.

Onion Architecture

The term onion architecture was first used by Jeffrey Palermo in his onion architecture blog post. Other names for similar architectural approaches are hexagonal architecture, ports and adapters, and clean architecture.

We built ArchUnit tests for this architectural style in the OnionArchitectureTest.kt file. It assumes a certain structure of all classes in the root package, i.e. the package of the OnionArchitectureTest class:

  • The core domain should be placed in the domain package. It contains the code logic of the application and is is independent of the infrastructure, adapters, frameworks in use, etc. We divide the package into two parts:
    • The domain.model package contains all models of the domain. Classes in this package do not have any dependencies to any other classes in the root package.
    • The domain.service package contains all logic of the domain. Classes in this package use the classes in domain.model package but do not have any dependencies to any other classes in the root package.
  • All application related parts, i.e. technical logic needed for the application to run and that are not part of the core domain, should be placed in the application package. Examples are global settings for date and time, e.g. a global Clock object, or security related configuration that is not part of an individual adapter. Classes in this package can access the domain package but do not depend on any other classes in the root package.
  • All external dependencies are placed in dedicated adapter packages. Examples are an adapter.persistence package that contains logic for storing and retrieving data from a data store or adapter.cli and adapter.rest packages for user interactions with the application. Classes in any adapter package can access all classes in the domain and application package but must not have dependencies on any other adapter packages.

Note that the example code in the onion package contain code that breaks the build. Uncomment the corresponding parts to make the tests pass.

Usage and Contribution

Let us know if you like ArchUnit and use the templates in this repository by leaving a tweet mentioning @archtests and @spanier_m.

If you want to change parts of these examples, simply open a pull request with the changes and/or open an issue.

archunit-junit5-kotlin's People

Contributors

boidolr avatar krzykrucz avatar spanierm42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.