Skip to content

Commit 0511f5f

Browse files
authored
Suppress exception test should not count as advice failure (#9658)
1 parent 9dd2203 commit 0511f5f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

testing-common/integration-tests/src/test/java/indy/IndyInstrumentationTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@
88
import static org.assertj.core.api.Assertions.assertThat;
99
import static org.assertj.core.api.Assertions.assertThatThrownBy;
1010

11+
import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
12+
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
13+
import io.opentelemetry.javaagent.testing.common.TestAgentListenerAccess;
1114
import org.junit.jupiter.api.AfterEach;
1215
import org.junit.jupiter.api.Test;
16+
import org.junit.jupiter.api.extension.RegisterExtension;
1317

1418
@SuppressWarnings({"unused", "MethodCanBeStatic"})
1519
public class IndyInstrumentationTest {
1620

21+
@RegisterExtension
22+
static final InstrumentationExtension testing = AgentInstrumentationExtension.create();
23+
1724
private String privateField;
1825

1926
// The following methods are instrumented by the IndyInstrumentationTestModule
@@ -92,6 +99,7 @@ void testAssignToReturnViaArray() {
9299
@Test
93100
void testSuppressException() {
94101
assertThat(noExceptionPlease("foo")).isEqualTo("foo_no_exception");
102+
assertThat(TestAgentListenerAccess.getAndResetAdviceFailureCount()).isEqualTo(2);
95103
}
96104

97105
@Test

0 commit comments

Comments
 (0)