Skip to content

Commit 2cafc7c

Browse files
mp911derstoyanchev
authored andcommitted
Polishing.
Refine assertions to ignore locale-specific error messages. See gh-1085
1 parent 821d480 commit 2cafc7c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

spring-graphql/src/test/java/org/springframework/graphql/observation/GraphQlObservationInstrumentationTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,14 @@ void shouldRecordGraphQlErrorsAsTraceEvents() {
343343

344344
assertThat(response.errorCount()).isEqualTo(1);
345345
assertThat(response.error(0).errorType()).isEqualTo("InvalidSyntax");
346-
assertThat(response.error(0).message()).startsWith("Invalid syntax with offending token 'invalid'");
346+
assertThat(response.error(0).message()).containsIgnoringCase("syntax")
347+
.containsIgnoringCase("token").contains("'invalid'");
347348

348349
assertThat(observationHandler.getEvents()).hasSize(1);
349350
Observation.Event errorEvent = observationHandler.getEvents().get(0);
350351
assertThat(errorEvent.getName()).isEqualTo("InvalidSyntax");
351-
assertThat(errorEvent.getContextualName()).startsWith("Invalid syntax with offending token 'invalid'");
352+
assertThat(errorEvent.getContextualName()).containsIgnoringCase("syntax")
353+
.containsIgnoringCase("token").contains("'invalid'");
352354

353355
TestObservationRegistryAssert.assertThat(this.observationRegistry).hasObservationWithNameEqualTo("graphql.request")
354356
.that().hasLowCardinalityKeyValue("graphql.outcome", "REQUEST_ERROR")

0 commit comments

Comments
 (0)