Skip to content

add haveDependenciesThat condition to ArchConditions#1580

Open
wakingrufus wants to merge 1 commit intoTNG:mainfrom
wakingrufus:haveDependenciesThat
Open

add haveDependenciesThat condition to ArchConditions#1580
wakingrufus wants to merge 1 commit intoTNG:mainfrom
wakingrufus:haveDependenciesThat

Conversation

@wakingrufus
Copy link
Copy Markdown

@wakingrufus wakingrufus commented Jan 19, 2026

there is not a good way to craft such a condition with current Public APIs

the use case I want this for is:

noClasses()
.should(
  haveAnyDependenciesThat(
    not(resideInSamePackage())
      .and(dependencyTarget(annotatedWith(Deprecated.class)))
    )
  )

where resideInSamePackage() is a DescribedPredicate which requires comparing the target and the owner in the same condition

Copy link
Copy Markdown

@StefanGraeber StefanGraeber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me :)

Signed-off-by: John Burns <wakingrufus@gmail.com>
@wakingrufus wakingrufus force-pushed the haveDependenciesThat branch from 1593ed1 to 75d0251 Compare April 27, 2026 15:30
@wakingrufus
Copy link
Copy Markdown
Author

Thanks! I rebased. Just need approval for workflows

quote(CallingClass.class.getName()), quote(SomeClass.class.getName())));

assertThat(haveAnyDependenciesThat(DescribedPredicate.<Dependency>alwaysTrue().as("custom")))
.hasDescription("have dependencies that custom")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoopsie. 😉

Suggested change
.hasDescription("have dependencies that custom")
.hasDescription("have any dependencies that custom")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants