Skip to content

Commit 3785329

Browse files
committed
relax a bit assertions for grails
1 parent 15f867f commit 3785329

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

instrumentation/grails-3.0/javaagent/src/test/java/test/GrailsTest.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.QUERY_PARAM;
1515
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.REDIRECT;
1616
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat;
17-
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
17+
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies;
1818

1919
import grails.boot.GrailsApp;
2020
import grails.boot.config.GrailsAutoConfiguration;
@@ -37,7 +37,6 @@
3737
import java.util.Locale;
3838
import java.util.Map;
3939
import java.util.function.Consumer;
40-
import org.apache.catalina.connector.ResponseFacade;
4140
import org.junit.jupiter.api.extension.RegisterExtension;
4241
import org.springframework.boot.autoconfigure.SpringBootApplication;
4342
import org.springframework.boot.autoconfigure.web.ServerProperties;
@@ -175,9 +174,8 @@ public SpanDataAssert assertResponseSpan(
175174
span.hasKind(SpanKind.INTERNAL)
176175
.satisfies(spanData -> assertThat(spanData.getName()).endsWith("." + methodName))
177176
.hasAttributesSatisfyingExactly(
178-
equalTo(
179-
CodeIncubatingAttributes.CODE_FUNCTION_NAME,
180-
ResponseFacade.class.getName() + "." + methodName));
177+
satisfies(
178+
CodeIncubatingAttributes.CODE_FUNCTION_NAME, v -> v.endsWith("." + methodName)));
181179
return span;
182180
}
183181

@@ -198,9 +196,9 @@ public List<Consumer<SpanDataAssert>> errorPageSpanAssertions(
198196
span.satisfies(spanData -> assertThat(spanData.getName()).endsWith(".sendError"))
199197
.hasKind(SpanKind.INTERNAL)
200198
.hasAttributesSatisfyingExactly(
201-
equalTo(
199+
satisfies(
202200
CodeIncubatingAttributes.CODE_FUNCTION_NAME,
203-
ResponseFacade.class.getName() + ".sendError")));
201+
v -> v.endsWith(".sendError"))));
204202
}
205203
return spanAssertions;
206204
}

0 commit comments

Comments
 (0)