mercredi 29 mai 2019

Send wildcard param in a MockMvc test

Hy everyone, I am working with the sping rest docs libray and I have to send a wildcard param to some mocked method, I'm doing the next:

val contextRequest = RequestBrowsePlayerContext(this.standardContext, this.sWDIContext, this.uIDContext, this.seeAllContext, apiRequest)
        `when`(browsePlayerServiceRepresentable.getEntitiesBrowse(contextRequest)).thenReturn(Single.just(presentBrowsePlayers()))

But I want to send a wildcard param because I am getting null in the test, due to they are different objects, I know that wuth spock we can do something like:

mockBrowsePlayerProvider.getEntitiesBrowse(_ as BrowsePlayerContext) >> Single.just(buildMockEntitiesBrowse())

And we can use the _ wildcard param. But I don't know how to do that in kotlin.

Any ideas?

Aucun commentaire:

Enregistrer un commentaire