Assert.isEquals(obj1,obj2);
Assert.isEquals(obj1,obj2,"obj1 must be equals obj2");
superType.isAssignableFrom(subType) 是否为 true.superType.isAssignableFrom(subType) 是否为 true.true 抛出指定类型异常
Assert.isFalse(i > 0, ()->{
// to query relation message
return new BusinessException("relation message to return");
});
true 抛出 BusinessException 异常Assert.isFalse(i < 0, "The value must not be negative");
true 抛出 BusinessException 异常Assert.isFalse(i < 0);
Assert.instanceOf(Foo.class, foo);
Assert.instanceOf(Foo.class, foo, "foo must be an instance of class Foo");
null ,如果不为null 抛出指定类型异常
并使用指定的函数获取错误信息返回
Assert.isNull(value, ()->{
// to query relation message
return new BusinessException("relation message to return");
});
false 抛出给定的异常Assert.isTrue(i > 0, BusinessException::new);
false 抛出 BusinessException 异常Assert.isTrue(i > 0, "The value must be greater than zero");
false 抛出 BusinessException 异常Assert.isTrue(i > 0);
null元素,如果数组为空或 null将被认为不包含
并使用指定的函数获取错误信息返回
Assert.noNullElements(array, ()->{
// to query relation message
return new BusinessException("relation message to return ");
});
null元素,如果数组为空或 null将被认为不包含
Assert.noNullElements(array, "The array must not have null elements");
null元素,如果数组为空或 null将被认为不包含
Assert.noNullElements(array);
BusinessException
Assert.notBlank(name, "Name must not be blank");
BusinessException
Assert.notBlank(name);
Assert.notContain(name, "rod", ()->{
// to query relation message
return new BusinessException("relation message to return ");
});
Assert.notContain(name, "rod", "Name must not contain 'rod'");
Assert.notContain(name, "rod");
BusinessException
Assert.notEmpty(name, "Name must not be empty");
BusinessException
Assert.notEmpty(name);
null 且至少包含一个元素
并使用指定的函数获取错误信息返回
Assert.notEmpty(array, ()->{
// to query relation message
return new BusinessException("relation message to return");
});
null 且至少包含一个元素
Assert.notEmpty(array, "The array must have elements");
null 且至少包含一个元素
Assert.notEmpty(array, "The array must have elements");
Assert.notEmpty(collection, ()->{
// to query relation message
return new BusinessException("relation message to return");
});
Assert.notEmpty(collection, "Collection must have elements");
Assert.notEmpty(collection);
Assert.notEmpty(map, ()->{
// to query relation message
return new BusinessException("relation message to return");
});
Assert.notEmpty(map, "Map must have entries");
Assert.notEmpty(map, "Map must have entries");
Assert.notEquals(obj1,obj2);
Assert.notEquals(obj1,obj2,"obj1 must be not equals obj2");
null ,如果为null 抛出指定类型异常
并使用指定的函数获取错误信息返回
Assert.notNull(clazz, ()->{
// to query relation message
return new BusinessException("relation message to return");
});
IllegalStateException。IllegalStateException。IllegalStateException。Copyright © 2023. All rights reserved.