Skip to main content

Questions tagged [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.

archunit
0 votes
1 answer
15 views

Custom gradle Plugin to Run on Client Projects code

In our organization, we have a repository where we export a variety of plugins related to checkstyle, PMD, component testing, and Liquibase, among other things. I created a simple plugin with a task ...
Codex's user avatar
  • 1,273
0 votes
1 answer
36 views

Check if a field is initialized with ArchUnit

I have a class that looks like this: public class A { private B b1 = new B(); private C c = new C(); private B b2; } I want to write an ArchUnit test that finds all the fields in class A ...
SCM's user avatar
  • 51
0 votes
1 answer
21 views

ArchRule fails on proper test

I have test @ArchTest public static final ArchRule daoShouldBeUsedOnlyByHelper = theClass(SegmentDAO.class).should() .onlyBeAccessed() .byClassesThat(simpleName(SegmentHelper.class....
thomas113412's user avatar
0 votes
1 answer
61 views

Checking parameters of all method calls

I work on a Java app which uses a ResourceBundle with a static helper class. Simplified it works like this: class Bundle() { static String get(key) { resourceBundle.get(key) } } uiClass() {...
Kathi's user avatar
  • 5
0 votes
1 answer
75 views

What belongs in the applicationService package to properly test the onion architecture with ArchUnit?

I am currently in the process of implementing a simple hexagonal architecture. I have followed the DDD principle and placed the DomainModels alongside the DomainServices in a domain-package. In ...
Danny Steinbrecher's user avatar
0 votes
1 answer
98 views

Test classes are not fed into ArchUnit test case

I fail to implement an ArchUnit test that is meant to prevent test cases getting written that are named with the work "failed" as part of their method name. For that I use the ImportOption....
arkascha's user avatar
  • 42.4k
0 votes
1 answer
67 views

Using archunit to enforce all sub-packages only reference themselves of a "common" package

If i have a package structure like: org.myapp common feature1 feature2 ... I would like to write an archunit test that checks if all classes inside the feature packages only reference other classes ...
Hugo Palma's user avatar
  • 3,516
0 votes
0 answers
25 views

archunit : validating that we never forget root Throwable when rethrowing an exception

Using Archunit, I would like to enforce that whenever we catch an exception and rethrow one, the original Throwable is always included in the constructor of the new exception. the pseudo algorithm ...
Vincent F's user avatar
  • 7,081
0 votes
1 answer
62 views

ArchUnit: Test a class if it contains an annotated method

I want to write an archunit rule in my J2EE project to test when a class is annotated with @Startup, then it must contain a method that is annotated with @PostConstruct. I tried this @ArchTest ...
MichaelM's user avatar
-1 votes
1 answer
47 views

How do I exclude basic Java functionality from layered architecture tests in ArchUnit?

I have written up the following test for my clean architecture. I still have a lot of violations like java.util functionality. Can I somehow exclude them from the LayeredArchitecture ArchUnit concept? ...
Maevy's user avatar
  • 299
0 votes
1 answer
46 views

ResidesOutsideOfPackages but for classes in arch unit tests

val rule: ArchRule = noClasses().that().resideInAPackage("$Base.app..") .should().dependOnClassesThat().resideOutsideOfPackages(allowablePackages) rule.check(...
HomeLighter's user avatar
0 votes
1 answer
123 views

How to exclude specific classes with ArchUnit tests?

I currently have a simple ArchUnit test that checks that all classes that reside in a package should only be accessed within that class. However, I want to exclude one specific class from that rule ...
HomeLighter's user avatar
1 vote
0 answers
50 views

C# Arch Unit - Avoid calling System.String.Substring()

I'm trying to understand how to avoid calling a method like "System.String.Substring()" with ArchUnit framework by TNG. First I have a simple library Lib with static method: namespace Lib { ...
TorstenM's user avatar
0 votes
1 answer
71 views

ArchUnitTest not running as expected

Could anyone say why am I getting these errors, given the configurations below? Message:  ArchUnitNET.xUnit.FailedArchRuleException : "Classes that are Classes that are Classes that implement '...
Lombardo's user avatar
0 votes
1 answer
177 views

ArchUnit: how to check for extension of an interface?

I have a package for which I want to check that all classes (these are entities that can get shipped over the net) do indeed implement the interface "java.io.Serializable". So I defined ...
mmo's user avatar
  • 4,062

15 30 50 per page
1
2 3 4 5
10