Better Checks ![build status](https://camo.githubusercontent.com/8abc378fb30b76ca8c50544170eb80f67242d40e4d27df334235549a73b8f10c/68747470733a2f2f7472617669732d63692e6f72672f726f6c76652f6265747465722d636865636b732e737667)
The Better Checks library provides a lightweight and concise, but powerful way for precodition checking in Java, in particular for method arguments. Checks are written in a fluent way.
Examples:
Check.that(name).matches("hello .*!").hasLengthBetween(0, 20);
Check.that(list).isNullOr().hasSize(0);
Check.that(args).named("arguments").isNotEmpty();
The actual checking methods, such as matches(...)
or hasSize(...)
, all throw an exception if the check fails. The exact type of exception depends on the kind of check that is called but in most cases it is IllegalArgumentException
.
Project Website
For more information, visit the project's website: