spring-modulith
spring-modulith copied to clipboard
State change detection for `Scenarios` should only accept non-empty collections by default
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()).