toHoldThirdPartyExpectation
fun <T> Expect<T>.toHoldThirdPartyExpectation(description: String, representation: Any?, expectationExecutor: (T) -> Unit): Expect<T>(source)
Expects that the expectationExecutor doesn't throw and creates an assertion representing this third party expectation with the given description and representation.
Return
an Expect for the subject of this
expectation.
Since
1.2.0
Parameters
description
The description of the third party expectation.
representation
The representation of the third party expectation.
expectationExecutor
The lambda which executes the third party expectation where the current subject is passed as parameter.
Samples
expect(listOf(1)).get(0) {
toHoldThirdPartyExpectation("(assertJ) is equal to", 1) { subject -> // 1
assertThat(subject).isEqualTo(1)
}
}
fails {
expect(listOf(1)).get(0) {
toHoldThirdPartyExpectation("(assertJ) is equal to", 1) { subject -> // 1
// throws and thus the expectation that the third-party expectation holds fails
assertThat(subject).isEqualTo(2)
}
}
}