![JAR search and dependency download from the Maven repository](/logo.png)
io.opentelemetry.instrumentation.testing.junit.LibraryInstrumentationExtension Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opentelemetry-testing-common Show documentation
Show all versions of opentelemetry-testing-common Show documentation
OpenTelemetry Javaagent testing commons
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.instrumentation.testing.junit;
import io.opentelemetry.instrumentation.testing.LibraryTestRunner;
/**
* JUnit 5 extension for writing library instrumentation tests.
*
* Example usage:
*
*
* class MyLibraryInstrumentationTest {
* {@literal @}RegisterExtension
* static final LibraryInstrumentationExtension instrTesting = LibraryInstrumentationExtension.create();
*
* {@literal @}Test
* void test() {
* // test code ...
*
* var spans = instrTesting.spans();
* // assertions on collected spans ...
* }
* }
*
*/
public final class LibraryInstrumentationExtension extends InstrumentationExtension {
private LibraryInstrumentationExtension() {
super(LibraryTestRunner.instance());
}
public static LibraryInstrumentationExtension create() {
return new LibraryInstrumentationExtension();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy