You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So the problem with the example is there isn't always a valid greater than, and I'm making up versions that I won't be generating just to fill it in. I've realized it would be nice to have a way to skip or pass a single assertion if it met certain criteria
I'd change the impossible values to null and do
assertThat(...).skipIf(v -> greaterThan == null);
Obviously I can just do an if statement or another test. Somehow to me this feels cleaner, as technically the code still executes.
BDD given/assumeThat isn't the same, because I don't want to skip the entire test, I just want to not fail this 1 assertion.
it'd be almost equivalent to the following, except the assertion wouldn't be called at all here, and it should be with skipIf
if (greaterThan != null) assertThat(newComparableVersion(semv.toString()))
.describedAs("mvn")
.isGreaterThan(newComparableVersion(greaterThan));
could also call it passIf, unless (very perl-ish). I thought of using filter too but I think that'd be confusing. I suppose when thinking about chaining though
// would pass even if lessThan is falseassertThat(...).passIf( t -> greaterThan == null).isLessThan(...).isGreaterThan(greaterThan);
// would fail if less than is false but wouldn't run greater than, works like filterassertThat(...).isLessThan(...).skipIf( t -> greaterThan == null).isGreaterThan(greaterThan);
// honestly seems same as passif to me because perl. Those only make sense at beginning or end of chain. assertThat(...).isLessThan(...).isGreaterThan(greaterThan).unless( t -> greaterThan == null );
Possibly has some additional benefit if integrating with Soft Assertions (I find "Soft" weirdly named, and didn't know they were a thing before now), as maybe they can "log" this.
note: I'm fairly confident that this comparison stuff is not the first time I've wanted this.
Feature summary
So the problem with the example is there isn't always a valid greater than, and I'm making up versions that I won't be generating just to fill it in. I've realized it would be nice to have a way to skip or pass a single assertion if it met certain criteria
I'd change the impossible values to null and do
Obviously I can just do an if statement or another test. Somehow to me this feels cleaner, as technically the code still executes.
BDD
given
/assumeThat
isn't the same, because I don't want to skip the entire test, I just want to not fail this 1 assertion.it'd be almost equivalent to the following, except the assertion wouldn't be called at all here, and it should be with
skipIf
could also call it
passIf
,unless
(very perl-ish). I thought of usingfilter
too but I think that'd be confusing. I suppose when thinking about chaining thoughPossibly has some additional benefit if integrating with Soft Assertions (I find "Soft" weirdly named, and didn't know they were a thing before now), as maybe they can "log" this.
note: I'm fairly confident that this comparison stuff is not the first time I've wanted this.
Example
The text was updated successfully, but these errors were encountered: