Skip to content

Commit

Permalink
Suppress exception test should not count as advice failure (#9658)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit committed Oct 12, 2023
1 parent 9dd2203 commit 0511f5f
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
import io.opentelemetry.javaagent.testing.common.TestAgentListenerAccess;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

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

@RegisterExtension
static final InstrumentationExtension testing = AgentInstrumentationExtension.create();

private String privateField;

// The following methods are instrumented by the IndyInstrumentationTestModule
Expand Down Expand Up @@ -92,6 +99,7 @@ void testAssignToReturnViaArray() {
@Test
void testSuppressException() {
assertThat(noExceptionPlease("foo")).isEqualTo("foo_no_exception");
assertThat(TestAgentListenerAccess.getAndResetAdviceFailureCount()).isEqualTo(2);
}

@Test
Expand Down

0 comments on commit 0511f5f

Please sign in to comment.