test: rework GameSimulationTest for greater robustness

This commit is contained in:
2025-04-12 03:25:28 +02:00
parent af1e5ee22a
commit f85f5986b4
2 changed files with 84 additions and 95 deletions

View File

@@ -31,6 +31,9 @@ class PlayerNotificationListener(
) {
private val logger = KotlinLogging.logger {}
/**
* Forward projection from [bus][GameProjectionBus] to the player [notification][outgoingNotification]
*/
fun startListening(
currentPlayer: Player,
gameId: GameId,
@@ -39,7 +42,7 @@ class PlayerNotificationListener(
return projectionBus.subscribe { currentState ->
if (currentState !is GameState) return@subscribe
if (currentState.aggregateId != gameId) return@subscribe
withLoggingContext("projection" to currentState.toString()) {
withLoggingContext("currentPlayer" to currentPlayer.toString(), "projection" to currentState.toString()) {
fun Notification.send() {
withLoggingContext("notification" to this.toString()) {
if (currentState.players.contains(currentPlayer)) {