在TestCase Statment中,在将Springboot版本从2.1.7升级到2.6.4之后会出现错误。
遇到错误
@Test
fun `Should include id in all outbound requests`() {
(authenticationSource as TestAuthenticationSource).setCoordinatorToken()
val request = PersonSearch().apply {
firstName = “Xyz”
lastName = “Abc”
}
val oid = UUID.randomUUID().toString()
client
.post()
.uri("/v/search/outbound")
.headers {
it.setBearerAuth("fakeToken")
it.set(CORRELATION_ID, oid)
}
.body(Mono.just(request), PersonSearch::class.java)
.exchange()
assertThat(server.requestCount).isEqualTo(2)
// The bellow line give error while it was working fine in previous version
assertThat(server.takeAllRequests()).allSatisfy { assertThat(it.headers.toMultimap()).containsEntry(CORRELATION_ID, listOf(oid)) }
// Trying in this way as well
assertThat(server.takeAllRequests()).allSatisfy { it -> assertThat(it.headers.toMultimap()).containsEntry(CORRELATION_ID, listOf(oid)) }
}
将弹簧启动版本更新为2.6.4 我在旧版本2.1.7 中 >显示第一行AS -
Overload resolution ambiguity. All these functions match.
public open fun allSatisfy(requirements: Consumer<in RecordedRequest!>!): ObjectArrayAssert<RecordedRequest!>! defined in org.assertj.core.api.ObjectArrayAssert
public open fun allSatisfy(requirements: ThrowingConsumer<in RecordedRequest!>!): ObjectArrayAssert<RecordedRequest!>! defined in org.assertj.core.api.ObjectArrayAssert
虽然它在运行时抛出相同的 exception 消息 -
Kotlin: Overload resolution ambiguity:
public open fun allSatisfy(p0: Consumer<in RecordedRequest!>!): ObjectArrayAssert<RecordedRequest!>! defined in org.assertj.core.api.ObjectArrayAssert
public open fun allSatisfy(p0: ThrowingConsumer<in RecordedRequest!>!): ObjectArrayAssert<RecordedRequest!>! defined in org.assertj.core.api.ObjectArrayAssert
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能正在击中 https://github.com/assertj/assertj/assertj/assertj/assertj-core/issues/ 2357 。
对于解决方法,请参见:
You are likely hitting https://github.com/assertj/assertj-core/issues/2357.
For workarounds see:
如此url assertj-core/desission/dessise/2357 由@joel Costigliola建议在完全满意以消除歧义之后,我进行了一些小的更改,只是消费者键。
As in this url assertj-core/issues/2357 suggested by @Joel Costigliola I have made small changes just added Consumer key after allSatisfy to eliminate the ambiguity.