Skip to content

Commit 1bc5d0a

Browse files
committed
Clarify Scala satisfies parameter naming
1 parent 8bdbe2e commit 1bc5d0a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

.github/agents/knowledge/testing-general-patterns.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@
5959
values.** Inside a `satisfies(AttributeKey, Consumer)` lambda the parameter (e.g., `taskId`) is
6060
an `AbstractStringAssert<?>` (for string keys), `AbstractLongAssert<?>` (for long keys), etc.
6161
Fluent assertion calls like `taskId.contains(jobName)` or `taskId.startsWith(prefix)` are
62-
already proper AssertJ assertions they throw on failure. Do **not** wrap them in
62+
already proper AssertJ assertions - they throw on failure. Do **not** wrap them in
6363
`assertThat(value.contains(x)).isTrue()`, which degrades the failure message.
6464

65-
- For `satisfies(AttributeKey, lambda)` outer parameters, use `val`.
65+
- For `satisfies(AttributeKey, lambda)` outer parameters, use `val` in Java.
66+
In Scala, use `value` instead, since `val` is a reserved word.
6667
Do not use short generic alternatives like `k` or `v` for the outer parameter.
6768
- If an attribute-assertion `satisfies(...)` lambda contains a nested inner lambda and a second
68-
parameter name is required, keep the outer parameter as `val` and use `v` for the nested
69-
parameter.
69+
parameter name is required, keep the outer parameter as `val` in Java or `value` in Scala,
70+
and use `v` for the nested parameter.
7071
- This naming guidance does **not** apply to non-attribute `satisfies(...)` usages such as
7172
`span.satisfies(...)`, `point.satisfies(...)`, or `assertThat(result).satisfies(...)`.
7273
In those cases, prefer a descriptive subject name like `spanData`, `pointData`, `resource`,

0 commit comments

Comments
 (0)