A new rule to suggest usages of all would be helpful.
Perhaps, given code like this, we'd get a warning to use all instead:
assertThat(complexType.skyIsBlue).isTrue()
assertThat(complexType.raining).isFalse()
assertThat(complexType.cake.yummy).isTrue()
I think this would be better written with all:
assertThat(complexType).all {
prop(ComplexType::skyIsBlue).isTrue()
prop(ComplexType::raining).isFalse()
prop(ComplexType::cake).isInstanceOf(Cake::class).prop(Cake::yummy).isTrue()
}
In this case, with all we'd get the evaluations for raining and cake even if the sky isn't blue.
Maybe the rule could check for 3+ assertions on the same variable and then suggest using all instead?
A new rule to suggest usages of
allwould be helpful.Perhaps, given code like this, we'd get a warning to use
allinstead:I think this would be better written with all:
assertThat(complexType).all { prop(ComplexType::skyIsBlue).isTrue() prop(ComplexType::raining).isFalse() prop(ComplexType::cake).isInstanceOf(Cake::class).prop(Cake::yummy).isTrue() }In this case, with
allwe'd get the evaluations forrainingandcakeeven if the sky isn't blue.Maybe the rule could check for 3+ assertions on the same variable and then suggest using all instead?