Skip to content

Commit 4cfc49d

Browse files
runningcodeclaude
andcommitted
test(spring-boot): Return a Mono from the Boot 4 WebFlux GraphQL resolver
The sample's resolver returned a Mono, so its test covered Sentry finishing the field's span when the Mono completes. The port returned a String, which only covers the synchronous path. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 3aa588c commit 4cfc49d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎sentry-spring-boot-4/src/integrationTestWebflux/kotlin/io/sentry/spring/boot4/webfluxintegrationtest/WebfluxIntegrationTestApplication.kt‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,13 @@ class TodoController(private val webClient: WebClient) {
9494
/** Throws when given "crash", so tests can check error reporting. */
9595
@Controller
9696
class GreetingController {
97+
// Returns a Mono, as a reactive app would, so the test covers Sentry finishing the field's span
98+
// asynchronously.
9799
@QueryMapping
98-
fun greeting(@Argument name: String): String {
100+
fun greeting(@Argument name: String): Mono<String> {
99101
if (name == "crash") {
100102
throw RuntimeException("causing an error for $name")
101103
}
102-
return "Hello $name!"
104+
return Mono.just("Hello $name!")
103105
}
104106
}

0 commit comments

Comments
 (0)