Skip to content

WebTestClient cannot assert null list elements #36476

Closed

Description

@bclozel

With the current nullness information, Kotlin developers cannot test valid JSON responses like:

[null]

The following code snippet does not compile because expectBodyList expects a non nullable type.

webTestClient
		.get().uri("/")
		.exchange()
		.expectBodyList<String?>().contains(null)

This needs changes in the Kotlin extension function itself, but also will also require additional changes in Framework. This is similar to spring-projects/spring-graphql#1424

Activity

  1. added this to the 7.0.7 milestone on Mar 16, 2026
  2. self-assigned this
    on Mar 16, 2026
  3. added
    in: webIssues in web modules (web, webmvc, webflux, websocket)
    on Mar 16, 2026
  4. added a commit that references this issue on Mar 16, 2026
    df81736
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions