Class OpenTelemetryAssertions
java.lang.Object
org.assertj.core.api.Assertions
io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions
- All Implemented Interfaces:
org.assertj.core.api.InstanceOfAssertFactories
public final class OpenTelemetryAssertions
extends org.assertj.core.api.Assertions
Entry point for assertion methods for OpenTelemetry types. To use type-specific assertions,
static import any
assertThat method in this class instead of
Assertions.assertThat.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interfacestatic interface -
Field Summary
Fields inherited from interface org.assertj.core.api.InstanceOfAssertFactories
ARRAY, ARRAY_2D, ATOMIC_BOOLEAN, ATOMIC_INTEGER, ATOMIC_INTEGER_ARRAY, ATOMIC_INTEGER_FIELD_UPDATER, ATOMIC_LONG, ATOMIC_LONG_ARRAY, ATOMIC_LONG_FIELD_UPDATER, ATOMIC_MARKABLE_REFERENCE, ATOMIC_REFERENCE, ATOMIC_REFERENCE_ARRAY, ATOMIC_REFERENCE_FIELD_UPDATER, ATOMIC_STAMPED_REFERENCE, BIG_DECIMAL, BIG_INTEGER, BOOLEAN, BOOLEAN_2D_ARRAY, BOOLEAN_ARRAY, BYTE, BYTE_2D_ARRAY, BYTE_ARRAY, CHAR_2D_ARRAY, CHAR_ARRAY, CHAR_SEQUENCE, CHARACTER, CLASS, COLLECTION, COMPLETABLE_FUTURE, COMPLETION_STAGE, DATE, DOUBLE, DOUBLE_2D_ARRAY, DOUBLE_ARRAY, DOUBLE_PREDICATE, DOUBLE_STREAM, DURATION, FILE, FLOAT, FLOAT_2D_ARRAY, FLOAT_ARRAY, FUTURE, INPUT_STREAM, INSTANT, INT_2D_ARRAY, INT_ARRAY, INT_PREDICATE, INT_STREAM, INTEGER, ITERABLE, ITERATOR, LIST, LOCAL_DATE, LOCAL_DATE_TIME, LOCAL_TIME, LONG, LONG_2D_ARRAY, LONG_ADDER, LONG_ARRAY, LONG_PREDICATE, LONG_STREAM, MAP, MATCHER, OFFSET_DATE_TIME, OFFSET_TIME, OPTIONAL, OPTIONAL_DOUBLE, OPTIONAL_INT, OPTIONAL_LONG, PATH, PERIOD, PREDICATE, SHORT, SHORT_2D_ARRAY, SHORT_ARRAY, SPLITERATOR, STREAM, STRING, STRING_BUFFER, STRING_BUILDER, THROWABLE, URI_TYPE, URL_TYPE, ZONED_DATE_TIME -
Method Summary
Modifier and TypeMethodDescriptionstatic AttributesAssertassertThat(io.opentelemetry.api.common.Attributes attributes) Returns an assertion forAttributes.static LogRecordDataAssertassertThat(io.opentelemetry.sdk.logs.data.LogRecordData log) Returns an assertion forLogRecordData.static MetricAssertassertThat(io.opentelemetry.sdk.metrics.data.MetricData metricData) Returns an assertion forMetricData.static EventDataAssertassertThat(io.opentelemetry.sdk.trace.data.EventData eventData) Returns an assertion forEventDataAssert.static SpanDataAssertassertThat(io.opentelemetry.sdk.trace.data.SpanData spanData) Returns an assertion forSpanData.attributeEntry(String key, boolean value) Returns an attribute entry with a boolean value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]).attributeEntry(String key, boolean... value) Returns an attribute entry with a boolean array value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]).attributeEntry(String key, double value) Returns an attribute entry with a double value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]).attributeEntry(String key, double... value) Returns an attribute entry with a double array value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]).attributeEntry(String key, long value) Returns an attribute entry with a long value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]).attributeEntry(String key, long... value) Returns an attribute entry with a long array value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]).attributeEntry(String key, String value) Returns an attribute entry with a String value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]).attributeEntry(String key, String... value) Returns an attribute entry with a String array value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]).static AttributeAssertionstatic <T> AttributeAssertionequalTo(io.opentelemetry.api.common.AttributeKey<T> key, T value) static AttributeAssertionsatisfies(io.opentelemetry.api.common.AttributeKey<Boolean> key, OpenTelemetryAssertions.BooleanAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion.static AttributeAssertionsatisfies(io.opentelemetry.api.common.AttributeKey<Double> key, OpenTelemetryAssertions.DoubleAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion.static AttributeAssertionsatisfies(io.opentelemetry.api.common.AttributeKey<Long> key, OpenTelemetryAssertions.LongAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion.static AttributeAssertionsatisfies(io.opentelemetry.api.common.AttributeKey<String> key, OpenTelemetryAssertions.StringAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion.static AttributeAssertionsatisfies(io.opentelemetry.api.common.AttributeKey<List<Boolean>> key, OpenTelemetryAssertions.BooleanListAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion.static AttributeAssertionsatisfies(io.opentelemetry.api.common.AttributeKey<List<Double>> key, OpenTelemetryAssertions.DoubleListAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion.static AttributeAssertionsatisfies(io.opentelemetry.api.common.AttributeKey<List<Long>> key, OpenTelemetryAssertions.LongListAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion.static AttributeAssertionsatisfies(io.opentelemetry.api.common.AttributeKey<List<String>> key, OpenTelemetryAssertions.StringListAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion.Methods inherited from class org.assertj.core.api.Assertions
allOf, allOf, anyOf, anyOf, as, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThatCode, assertThatCollection, assertThatComparable, assertThatException, assertThatExceptionOfType, assertThatIllegalArgumentException, assertThatIllegalStateException, assertThatIndexOutOfBoundsException, assertThatIOException, assertThatIterable, assertThatIterator, assertThatList, assertThatNoException, assertThatNullPointerException, assertThatObject, assertThatPath, assertThatPredicate, assertThatReflectiveOperationException, assertThatRuntimeException, assertThatStream, assertThatThrownBy, assertThatThrownBy, assertWith, atIndex, byLessThan, byLessThan, byLessThan, byLessThan, byLessThan, byLessThan, byLessThan, byLessThan, byLessThan, catchException, catchIllegalArgumentException, catchIllegalStateException, catchIndexOutOfBoundsException, catchIOException, catchNullPointerException, catchReflectiveOperationException, catchRuntimeException, catchThrowable, catchThrowableOfType, contentOf, contentOf, contentOf, contentOf, contentOf, contentOf, doesNotHave, entry, extractProperty, extractProperty, fail, fail, fail, failBecauseExceptionWasNotThrown, filter, filter, from, in, linesOf, linesOf, linesOf, linesOf, linesOf, linesOf, linesOf, linesOf, linesOf, not, not, notIn, offset, offset, registerCustomDateFormat, registerCustomDateFormat, registerFormatterForType, setAllowComparingPrivateFields, setAllowExtractingPrivateFields, setDescriptionConsumer, setExtractBareNamePropertyMethods, setLenientDateParsing, setMaxElementsForPrinting, setMaxLengthForSingleLineDescription, setMaxStackTraceElementsDisplayed, setPrintAssertionsDescription, setRemoveAssertJRelatedElementsFromStackTrace, shouldHaveThrown, tuple, useDefaultDateFormatsOnly, useDefaultRepresentation, useRepresentation, within, within, within, within, within, within, within, within, within, withinPercentage, withinPercentage, withinPercentage, withMarginOf, withPrecision, withPrecision
-
Method Details
-
assertThat
public static AttributesAssert assertThat(@Nullable io.opentelemetry.api.common.Attributes attributes) Returns an assertion forAttributes. -
assertThat
public static SpanDataAssert assertThat(@Nullable io.opentelemetry.sdk.trace.data.SpanData spanData) Returns an assertion forSpanData. -
assertThat
public static MetricAssert assertThat(@Nullable io.opentelemetry.sdk.metrics.data.MetricData metricData) Returns an assertion forMetricData.- Since:
- 1.14.0
-
assertThat
public static EventDataAssert assertThat(@Nullable io.opentelemetry.sdk.trace.data.EventData eventData) Returns an assertion forEventDataAssert. -
assertThat
public static LogRecordDataAssert assertThat(@Nullable io.opentelemetry.sdk.logs.data.LogRecordData log) Returns an assertion forLogRecordData.- Since:
- 1.27.0
-
attributeEntry
public static Map.Entry<io.opentelemetry.api.common.AttributeKey<String>,String> attributeEntry(String key, String value) Returns an attribute entry with a String value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]). -
attributeEntry
public static Map.Entry<io.opentelemetry.api.common.AttributeKey<Boolean>,Boolean> attributeEntry(String key, boolean value) Returns an attribute entry with a boolean value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]). -
attributeEntry
public static Map.Entry<io.opentelemetry.api.common.AttributeKey<Long>,Long> attributeEntry(String key, long value) Returns an attribute entry with a long value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]). -
attributeEntry
public static Map.Entry<io.opentelemetry.api.common.AttributeKey<Double>,Double> attributeEntry(String key, double value) Returns an attribute entry with a double value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]). -
attributeEntry
public static Map.Entry<io.opentelemetry.api.common.AttributeKey<List<String>>,List<String>> attributeEntry(String key, String... value) Returns an attribute entry with a String array value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]). -
attributeEntry
public static Map.Entry<io.opentelemetry.api.common.AttributeKey<List<Boolean>>,List<Boolean>> attributeEntry(String key, boolean... value) Returns an attribute entry with a boolean array value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]). -
attributeEntry
public static Map.Entry<io.opentelemetry.api.common.AttributeKey<List<Long>>,List<Long>> attributeEntry(String key, long... value) Returns an attribute entry with a long array value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]). -
attributeEntry
public static Map.Entry<io.opentelemetry.api.common.AttributeKey<List<Double>>,List<Double>> attributeEntry(String key, double... value) Returns an attribute entry with a double array value for use withAttributesAssert.containsOnly(java.util.Map.Entry[]). -
satisfies
public static AttributeAssertion satisfies(io.opentelemetry.api.common.AttributeKey<String> key, OpenTelemetryAssertions.StringAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion. -
satisfies
public static AttributeAssertion satisfies(io.opentelemetry.api.common.AttributeKey<Boolean> key, OpenTelemetryAssertions.BooleanAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion. -
satisfies
public static AttributeAssertion satisfies(io.opentelemetry.api.common.AttributeKey<Long> key, OpenTelemetryAssertions.LongAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion. -
satisfies
public static AttributeAssertion satisfies(io.opentelemetry.api.common.AttributeKey<Double> key, OpenTelemetryAssertions.DoubleAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion. -
satisfies
public static AttributeAssertion satisfies(io.opentelemetry.api.common.AttributeKey<List<String>> key, OpenTelemetryAssertions.StringListAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion. -
satisfies
public static AttributeAssertion satisfies(io.opentelemetry.api.common.AttributeKey<List<Boolean>> key, OpenTelemetryAssertions.BooleanListAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion. -
satisfies
public static AttributeAssertion satisfies(io.opentelemetry.api.common.AttributeKey<List<Long>> key, OpenTelemetryAssertions.LongListAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion. -
satisfies
public static AttributeAssertion satisfies(io.opentelemetry.api.common.AttributeKey<List<Double>> key, OpenTelemetryAssertions.DoubleListAssertConsumer assertion) Returns anAttributeAssertionthat asserts the givenkeyis present with a value satisfyingassertion. -
equalTo
public static <T> AttributeAssertion equalTo(io.opentelemetry.api.common.AttributeKey<T> key, T value) -
equalTo
public static AttributeAssertion equalTo(io.opentelemetry.api.common.AttributeKey<Long> key, int value)
-