在MockMvc测试中发送通配符参数

时间:2019-05-29 17:29:39

标签: testing kotlin spring-restdocs

大家好,我正在使用sping rest docs libray,并且我必须将通配符参数发送到某些模拟方法,而我正在做下一个:

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

但是我想发送通配符参数,因为在测试中我得到的是空值,由于它们是不同的对象,我知道我们可以执行以下操作:

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

我们可以使用_通配符参数。但是我不知道如何在Kotlin中做到这一点。

有什么想法吗?

0 个答案:

没有答案