Skip to content

Commit b4103c8

Browse files
runningcodeclaude
andcommitted
test(spring-boot): Return a Mono from the Boot 2 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 2411eee commit b4103c8

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • sentry-spring-boot/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/webfluxintegrationtest

‎sentry-spring-boot/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/webfluxintegrationtest/GreetingController.kt‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@ package io.sentry.spring.boot.webfluxintegrationtest
33
import org.springframework.graphql.data.method.annotation.Argument
44
import org.springframework.graphql.data.method.annotation.QueryMapping
55
import org.springframework.stereotype.Controller
6+
import reactor.core.publisher.Mono
67

78
/** Throws when given "crash", so tests can check error reporting. */
89
@Controller
910
open class GreetingController {
11+
// Returns a Mono, as a reactive app would, so the test covers Sentry finishing the field's span
12+
// asynchronously.
1013
@QueryMapping
11-
open fun greeting(@Argument name: String): String {
14+
open fun greeting(@Argument name: String): Mono<String> {
1215
if (name == "crash") {
1316
throw RuntimeException("causing an error for $name")
1417
}
15-
return "Hello $name!"
18+
return Mono.just("Hello $name!")
1619
}
1720
}

0 commit comments

Comments
 (0)