-
Notifications
You must be signed in to change notification settings - Fork 334
fix description of targetOwner predicate #1579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,6 +60,32 @@ public void origin_predicate() { | |
| assertThat(predicate).rejects(anyAccess()); | ||
| } | ||
|
|
||
| @Test | ||
| public void target_predicate() { | ||
| DescribedPredicate<JavaAccess<?>> predicate = | ||
| JavaAccess.Predicates.target(DescribedPredicate.<AccessTarget>alwaysTrue().as("some text")); | ||
|
|
||
| assertThat(predicate) | ||
| .hasDescription("target some text") | ||
| .accepts(anyAccess()); | ||
|
|
||
| predicate = JavaAccess.Predicates.target(alwaysFalse()); | ||
| assertThat(predicate).rejects(anyAccess()); | ||
| } | ||
|
|
||
| @Test | ||
| public void targetOwner_predicate() { | ||
| DescribedPredicate<JavaAccess<?>> predicate = | ||
| JavaAccess.Predicates.targetOwner(DescribedPredicate.<JavaClass>alwaysTrue().as("some text")); | ||
|
|
||
| assertThat(predicate) | ||
| .hasDescription("owner some text") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this text doesn't specify that the owner is related in any way to the target or any hint what is owned. I think the issue you are fixing here also exists for the origin(Owner) in exactly the same constellation. The test also doesn't test that the correct object is passed to the nested predicate (which also not done by origin_predicate) |
||
| .accepts(anyAccess()); | ||
|
|
||
| predicate = JavaAccess.Predicates.targetOwner(alwaysFalse()); | ||
| assertThat(predicate).rejects(anyAccess()); | ||
| } | ||
|
|
||
| @Test | ||
| public void convertTo() { | ||
| TestJavaAccess access = javaAccessFrom(importClassWithContext(String.class), "toString") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix you code formatting as described in https://github.com/TNG/ArchUnit/blob/main/CONTRIBUTING.md#formatting