Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 470 Bytes

File metadata and controls

19 lines (15 loc) · 470 Bytes

Preconditioner

Preconditioner is inspired by Google's Guava Precondions class. It allows to use a Preconditions like API with any kind of Exception:

Preconditioner precondition = new ExceptionReflectionPreconditioner(MyException.class);
precondition.check("TEST".equals(arg), "%s is not equals %s", arg, "TEST");

instead of

if(! "TEST".equals(arg))
{
	throw new MyException(String.format("%s is not equals %s", arg, "TEST"));
}