-
Notifications
You must be signed in to change notification settings - Fork 326
Closed as not planned
Description
Hello!
I have been writing some integration tests for my example class:
class ThingResponse(
val Id: String,,
val name: String,
val isCool: Boolean,
val associatedEntity: AssociatedEntity?
)
class AssociatedEntity(
Id: UUID,
val name: String,
val wow: String
)
In the test:
val responseFlux = documentName("onSubscription")
.variable("something", "123")
.variable("Something else", "3b23e223-2edb-4f5e-8e96-2e2607abd22b")
.executeSubscription()
.toFlux()
val verifier = StepVerifier.create(responseFlux)
.assertNext { response ->
run {
// should bring 5 thingResponses
var entities = response.path("onSubscription").entityList(ThingResponse::class.java)
.hasSize(5).get()
// 2 thingResponses should come with associatedEntity
//TODO how could i get the associatedEntity? without acessing [i]
// where i would know the index
}
}
.thenCancel()
.verifyLater()
The variable entities the fields come all mapped correctly besides the associatedEntity that comes always at null, is there any way the conversion of data could "cascade" down to the sub entities?
If this is already implemented in another way it would be awesome to know as well.
Further clarification:
- The subscription in itself returns a list of ThingResponse.
- The AssociatedEntity comes by schema mapping and it's a nullable field. I don't want to be restricted by order of which values are returned from the subscription.
- I would like to have a way to verify if that field comes null or not and if not to access its atributes.
- If I try to access the possible nullable field by:
response.path("onSubscription[3]. associatedEntity").entity(AssociatedEntity::class.java).get(). I can get a No results for path: $['data']['onSubscription'][3]['associatedEntity'])
How could I verify if it has a value and then get it.
Metadata
Metadata
Assignees
Labels
No labels