ArchUnit | Java architecture test library , to specify and assert | Code Analyzer library

 by   TNG Java Version: 1.2.0 License: Apache-2.0

kandi X-RAY | ArchUnit Summary

kandi X-RAY | ArchUnit Summary

ArchUnit is a Java library typically used in Code Quality, Code Analyzer applications. ArchUnit has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub, Maven.

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.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              ArchUnit has a medium active ecosystem.
              It has 2712 star(s) with 262 fork(s). There are 51 watchers for this library.
              There were 1 major release(s) in the last 12 months.
              There are 89 open issues and 400 have been closed. On average issues are closed in 33 days. There are 15 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of ArchUnit is 1.2.0

            kandi-Quality Quality

              ArchUnit has 0 bugs and 0 code smells.

            kandi-Security Security

              ArchUnit has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              ArchUnit code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              ArchUnit is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              ArchUnit releases are available to install and integrate.
              Deployable package is available in Maven.
              Build file is available. You can build the component from source.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed ArchUnit and discovered the below as its top functions. This is intended to give you an instant insight into ArchUnit implemented functionality, and help decide if they suit your requirements.
            • Makes the given parameter visitor visit each property .
            • Creates the class descriptor .
            • Returns the dependencies of a given annotation .
            • Find all strongly connected components of the given node that are strongly connected to the given node .
            • Attempt to create a dependency from an origin class and target supertype .
            • Parse the ASM type signature .
            • Get the type names of the member signature .
            • Format the value as a String .
            • Retrieves the classes needed for a particular test .
            • Builds the methods for the given class .
            Get all kandi verified functions for this library.

            ArchUnit Key Features

            No Key Features are available at this moment for ArchUnit.

            ArchUnit Examples and Code Snippets

            No Code Snippets are available at this moment for ArchUnit.

            Community Discussions

            QUESTION

            Archunit check method calls
            Asked 2022-Feb-11 at 14:56

            I have a class that has three methods that shouldn't be called from certain classes.

            How can I check this with Archunit?

            So for example

            ...

            ANSWER

            Answered 2022-Feb-11 at 09:02

            QUESTION

            How to check Methods return type in ArchUnit c#
            Asked 2022-Jan-28 at 14:21

            I need to check that there is only one class method ("ExampleMethod") that returns "ExampleType". Can I do this with ArchUnit in C #?

            ...

            ANSWER

            Answered 2021-Oct-28 at 14:29

            You don't need to use ArchUnit - or anything really, just use .NET's built-in reflection API:

            Source https://stackoverflow.com/questions/69755590

            QUESTION

            Can I check for usage of lombok.experimental.* annotations with ArchUnit?"
            Asked 2022-Jan-22 at 20:27

            As the question suggests, how can I check for certain imports with archUnit.

            So I want the test to fail, when the tested class itself imports lombok.experimental.*.

            I understand how to check for packages and stuff like that, but the approach doesnt seem to work for imports. Any suggestions?

            My Code:

            ...

            ANSWER

            Answered 2022-Jan-21 at 16:33

            An import does not generate any signature in the bytecode, so ArchUnit cannot detect it directly.
            Isn't it sufficient to check that your code does not depend on that package?

            Source https://stackoverflow.com/questions/70804356

            QUESTION

            Exclude the inner classes in Arch test
            Asked 2022-Jan-07 at 09:19

            haveSimpleNameEndingWith validation in ArchUnit is thorwing the following exception, how to exclude inner classes in the validation?

            Code

            ...

            ANSWER

            Answered 2022-Jan-07 at 09:19

            areTopLevelClasses() will help us to exclude the inner classes.

            Source https://stackoverflow.com/questions/70619052

            QUESTION

            How to allow only certain cyclic dependencies in ArchUnit?
            Asked 2021-Dec-22 at 12:24

            In ArchUnit, I can check that packages .should().beFreeOfCycles(). How can I specify exceptions to this rule for certain cycles?

            E.g., given these packages and their dependencies:

            ...

            ANSWER

            Answered 2021-Dec-20 at 11:03

            Freezing Arch Rules is always an option to allow for certain violations, but catch others.
            Would that be feasible in your case?

            Source https://stackoverflow.com/questions/70420442

            QUESTION

            Does exist a way to verify with ArchUnit that any method doesn´t throw any exception?
            Asked 2021-Nov-09 at 20:44

            I would like to know if exist a way in ArchUnit to avoid that the signature of a method throws any checked exception.

            ...

            ANSWER

            Answered 2021-Nov-09 at 20:44

            You can access a code unit's declared exceptions via JavaMethod.getThrowsClause() (or JavaConstructor.getThrowsClause(), respectively).

            The following rule using a custom condition forbids the declaration of any exceptions – you can easily adapt it to your needs if you want to exclude RuntimeExceptions:

            Source https://stackoverflow.com/questions/69751893

            QUESTION

            How to check that a constructor is called in the right classes with ArchUnit?
            Asked 2021-Oct-26 at 19:26

            Is there any way to enforce a rule like this one with ArchUnit :

            ...

            ANSWER

            Answered 2021-Oct-26 at 19:26

            Whenever you miss something in the predefined fluent API, try to define a custom predicate/condition. In your case: does this work for you?

            Source https://stackoverflow.com/questions/69723542

            QUESTION

            What causes this ArchUnit exception?
            Asked 2021-Oct-21 at 08:37

            Thanks for your time,

            I've been experimenting with Archunit, and I can't get my head around this issue:

            ...

            ANSWER

            Answered 2021-Oct-21 at 08:37

            As @Thomas got me thinking in the region of the source of my problem, I have solved it, as follows:

            The problem was that the packages that were part of my description of a component(A) were too vague, such that a description of another component(B), could also be considered of that component(A), so some of my classes were thought to belong to >=2 components.

            Source https://stackoverflow.com/questions/69642374

            QUESTION

            How to ignore static dependencies when using Archunit
            Asked 2021-Oct-12 at 13:57

            In one of my Archunit tests, I am checking (for example) that only classes in the service layer are depended on by classes in the presentation layer.

            This test is failing because, as far as I am able to determine, some classes in the presentation layer have static imports of constants in other non-service layers.

            How can I mitigate for this? One idea I have is to exclude static imports. How can I do this, using the fluent API?

            ...

            ANSWER

            Answered 2021-Oct-12 at 13:57

            There is enough between this and this to guide you(us).

            But, as @Manfred pointed out in the comments, static imports do not exist at byte code level, so this is not a problem, and I actually discovered that my issue was not caused by static imports, rather I just needed to grow my list of acceptable dependencies.

            Source https://stackoverflow.com/questions/69493755

            QUESTION

            ArchUnit - is there a way to check package access with a generic placeholder?
            Asked 2021-Jul-07 at 22:14

            I would like to check whether FOO.model is only accessed by FOO.service and BAR.model is only accessed by BAR.service and so on.

            Is there a way to achieve this with ArchUnit? Like (pseudocode)

            ...

            ANSWER

            Answered 2021-Jul-07 at 22:14

            You can use a custom condition to test the origin of each access:

            Source https://stackoverflow.com/questions/68269632

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install ArchUnit

            You can download it from GitHub, Maven.
            You can use ArchUnit like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the ArchUnit component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
            Maven
            Gradle
            CLONE
          • HTTPS

            https://github.com/TNG/ArchUnit.git

          • CLI

            gh repo clone TNG/ArchUnit

          • sshUrl

            git@github.com:TNG/ArchUnit.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Code Analyzer Libraries

            javascript

            by airbnb

            standard

            by standard

            eslint

            by eslint

            tools

            by rome

            mypy

            by python

            Try Top Libraries by TNG

            ArchUnitNET

            by TNGC#

            JGiven

            by TNGJava