Skip to content

Missing @Nullable on JsonPathAssertions.isEqualTo #35445

@Etienne522

Description

@Etienne522

Hello.

Unless I am very confused, the parameter expectedValue of JsonPathAssertions.isEqualTo should be Nullable, but it is not. If it is not supposed to be, then a isNull assertion would be helpful.

Full story on reddit https://www.reddit.com/r/Kotlin/comments/1nbnmrh/tell_kotlin_a_java_library_does_accept_null_values/ , when what I first thought was a problem with Kotlin turned out to be a missing Nullable in spring-test-6.2.10. To sum it up :

`webTestClient.get()

// ...

.jsonPath("$.phone_number").isEqualTo(testUserData.account.phoneNumber)`

in a kotlin project will prompt Intellij to send the warning "Java type mismatch: inferred type is 'String?', but 'Any' was expected." because phoneNumber can be null. The helpfull people on Reddit helped me figure it out : Kotlin thinks isEqualTo cannot accept null because the package is annotated with NonNullApi, but isEqualTo is not annotated with Nullable, even though opening isEqualTo show null is handled.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions