Skip to content

GraphQlTester: Type inference issues with Kotlin #112

Closed
@koenpunt

Description

@koenpunt

Similar to the type inference issues that were present with the WebTestClient.BodySpec, there are now also issues here with the GraphQlTester.EntitySpec.

So for example, the following code will not compile;

graphQlTester
  .query(query)
  .execute()
  .path("merchants.edges[0].node.id")
  .entity(String::class.java)
  .isEqualTo<String>(id)

It will instead result it the following error:

Type argument is not within its bounds.
Expected: Nothing!
Found: String!

Changing String to Nothing satisfies the compiler, but errors out at runtime with a KotlinNothingValueException.

graphQlTester
  .query(query)
  .execute()
  .path("merchants.edges[0].node.id")
  .entity(String::class.java)
  .isEqualTo<Nothing>(id)

The expected/preferred kotlin api would be something like:

graphQlTester
  .query(query)
  .execute()
  .path("merchants.edges[0].node.id")
  .entity<String>()
  .isEqualTo(id)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions