spring-modulith icon indicating copy to clipboard operation
spring-modulith copied to clipboard

State change detection for `Scenarios` should only accept non-empty collections by default

Open odrotbohm opened this issue 7 months ago • 3 comments
trafficstars

The Scenario API's When.andWaitForStateChange(…) currently works by applying default “non-null or empty” checks on the results of the function passed in. We wait for non-empty Optionals, boolean values of true etc. For collections, we currently fall back on our non-null interpretation. In other words, all non-null collections satisfy the criteria.

We should align the inspection with optional and only consider non-empty collections to satisfy the state change.

A workaround for the problem is calling .andWaitForStateChange(this::methodReturningACollection, it -> !it.isEmpty()).

odrotbohm avatar Mar 28 '25 08:03 odrotbohm