Add containsEntry overload that accepts int (#3412)

This commit is contained in:
Anuraag Agrawal 2021-07-21 13:41:59 +09:00 committed by GitHub
parent e4c03453eb
commit d4bbaf405d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -1,4 +1,7 @@
Comparing source compatibility of against
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.sdk.testing.assertj.AttributesAssert (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.testing.assertj.AttributesAssert containsEntry(io.opentelemetry.api.common.AttributeKey, int)
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.sdk.testing.assertj.SpanDataAssert (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.testing.assertj.SpanDataAssert hasException(java.lang.Throwable)

View File

@ -38,6 +38,11 @@ public final class AttributesAssert extends AbstractAssert<AttributesAssert, Att
return this;
}
/** Asserts the attributes have the given key and value. */
public AttributesAssert containsEntry(AttributeKey<Long> key, int value) {
return containsEntry(key, (long) value);
}
/** Asserts the attributes have the given key and string value. */
public AttributesAssert containsEntry(String key, String value) {
return containsEntry(AttributeKey.stringKey(key), value);

View File

@ -146,6 +146,8 @@ class OpenTelemetryAssertionsTest {
.containsEntry("bear", "mya")
.containsEntry("warm", true)
.containsEntry("temperature", 30)
.containsEntry(AttributeKey.longKey("temperature"), 30L)
.containsEntry(AttributeKey.longKey("temperature"), 30)
.containsEntry("length", 1.2)
.containsEntry("colors", "red", "blue")
.containsEntryWithStringValuesOf("colors", Arrays.asList("red", "blue"))