Skip to content

Commit

Permalink
test(wow-test): improve error handling in expectEventStream (#1095)
Browse files Browse the repository at this point in the history
- Enhance error message with stack trace information when domain event stream is null
- Improve test diagnostics by providing more detailed failure information
  • Loading branch information
Ahoo-Wang authored Jan 6, 2025
1 parent c501231 commit 6feb6af
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,18 @@ interface ExpectStage<S : Any> {
*/
fun expectEventStream(expected: Consumer<DomainEventStream>): ExpectStage<S> {
return expect {
assertThat("Expect the domain event stream is not null.", it.domainEventStream, notNullValue())
val reason = buildString {
append("Expect the domain event stream is not null.")
it.error?.let { error ->
appendLine()
append(error.stackTraceToString())
}
}
assertThat(
reason,
it.domainEventStream,
notNullValue()
)
expected.accept(it.domainEventStream!!)
}
}
Expand Down

0 comments on commit 6feb6af

Please sign in to comment.