I have a collection of objects:
data class WeatherForecast(
val city: String,
val forecast: String
// ...
)
I would like to test that each and every item matches given predicate on field.
Is there any assertion in kotlintest assertions
that will allow me to do so?
Something like:
forecasts.eachItemshouldMatch{ it.forecast == "SUNNY" }
What about using an inspector.
list.forAll {
it.forecast shouldBe "SUNNY"
}