Skip to content

Commit

Permalink
add hasAttributesSatisfying overload to AbstractPointAssert
Browse files Browse the repository at this point in the history
ref: #6031
  • Loading branch information
chungngoops committed Dec 6, 2023
1 parent 247ef4d commit 536c9de
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
Comparing source compatibility of against
No changes.
*** MODIFIED CLASS: PUBLIC ABSTRACT io.opentelemetry.sdk.testing.assertj.AbstractPointAssert (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
GENERIC TEMPLATES: === PointAssertT:io.opentelemetry.sdk.testing.assertj.AbstractPointAssert<PointAssertT,PointT><PointAssertT,PointT>, === PointT:io.opentelemetry.sdk.metrics.data.PointData
+++ NEW METHOD: PUBLIC(+) FINAL(+) io.opentelemetry.sdk.testing.assertj.AbstractPointAssert hasAttributesSatisfying(java.util.function.Consumer<io.opentelemetry.api.common.Attributes>)
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import javax.annotation.Nullable;
import org.assertj.core.api.AbstractAssert;
import org.assertj.core.api.Assertions;
Expand Down Expand Up @@ -111,6 +112,13 @@ public final PointAssertT hasAttributesSatisfying(Iterable<AttributeAssertion> a
return myself;
}

/** Asserts the point has attributes satisfying the given condition. */
public final PointAssertT hasAttributesSatisfying(Consumer<Attributes> attributes) {
isNotNull();
assertThat(actual.getAttributes()).as("attributes").satisfies(attributes);
return myself;

Check warning on line 119 in sdk/testing/src/main/java/io/opentelemetry/sdk/testing/assertj/AbstractPointAssert.java

View check run for this annotation

Codecov / codecov/patch

sdk/testing/src/main/java/io/opentelemetry/sdk/testing/assertj/AbstractPointAssert.java#L117-L119

Added lines #L117 - L119 were not covered by tests
}

/**
* Asserts the point has attributes matching all {@code assertions} and no more. Assertions can be
* created using methods like {@link OpenTelemetryAssertions#satisfies(AttributeKey,
Expand Down

0 comments on commit 536c9de

Please sign in to comment.