Hello, everyone!

How about to add isFalse assert in org.springframework.util.Assert class? I think it would be nice to avoid negative assertions like that code: Assert.isTrue(!expression, "assert error");

Or tell please, what is your approach to write negative assertions?

Thank you in advance! Your faithfully, springframework user

Comment From: Melancholic

Hi! I opened PR #27514 with resolving this issue.

Comment From: sbrannen

Hi @tral909,

Thanks for creating your first issue for the Spring Framework.

Many people have made suggestions to introduce additional convenience methods in Assert, StringUtils, and similar utilities in the Spring Framework; however, they have typically all been declined along the lines stated in https://github.com/spring-projects/spring-framework/issues/17766#issuecomment-453427274, essentially since these utilities are only intended for use within the framework itself.

Related Issues:

  • 810

  • 17508

  • 17766

  • 23749

In light of that, I am inclined to decline this request; however, I'll leave the issue open to allow the team to decide whether we want to potentially reconsider this for Spring Framework 6.0.

Comment From: bclozel

There isn't much demand for this and we tend to not introduce variants unless there is a clear use case for utility methods within Spring Framework. I'm closing this as a result.