Marcin Wisniowski
09/14/2023, 10:06 AMassert
fails when called on an empty list. If I have a rule checking something about all functions in a class, then some classes are going to have no functions and that’s fine, obviously they can’t violate the rules, it’s vacuously true. I’d expect it to behave the same as calling .all { ... }
on an empty collection - it returns true because no element violates the predicate.igor.wojda
09/14/2023, 11:34 AMMarcin Wisniowski
09/14/2023, 12:47 PMNatalia Peterwas
09/14/2023, 4:42 PMinterfaces
, but in test we write classes
etc.). But we will consider this problem again and try to solve it 🙂Natalia Peterwas
09/14/2023, 5:26 PMassert
method that will behave as you said before (we don’t have a good name for this “new” assertion - maybe assertRelaxed
?)
• adding an additional parameter to our assert
- then developer will be able to choose what behaviour he expects
What do you think about it? Maybe you have another idea?Marcin Wisniowski
09/14/2023, 6:29 PMcollection.shouldContainOnlyNulls()
passes when the collection is empty. I think that should be the default behaviour, and failing on an empty collection could be another assertNotEmpty()
to chain if needed.igor.wojda
09/14/2023, 6:31 PMassertNotEmpty
we will address this with the next releaseigor.wojda
09/18/2023, 9:24 AMassert
assertNot
Add methods with a new behaviour where an empty list will pass. Add strict = false
(default false
) param (if someone wants this strict verification e.g for debugging):
assertTrue (strict = true)
assertFalse (strict = true)