import com.google.common.collect.Lists;
import com.shein.dms.common.BasicCase;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;
import org.testng.annotations.Test;
/**
* @author :gongxr
* @description:测试springframework的Assert功能
*/
@Slf4j
public class TestAssert extends BasicCase {
String object = null;
String a = "abc";
String b = "b";
@Test
public void notNull() throws Exception {
Assert.notNull(object, "不能为null");
}
@Test
public void isTrue() throws Exception {
Assert.isTrue(false, "不为真!");
}
@Test
public void notEmpty() throws Exception {
Assert.notEmpty(Lists.newArrayList(), "列表不能为空!");
}
@Test
public void doesNotContain() throws Exception {
boolean flag = a.contains(b);
log.info("a.contains(b):{}", flag);
Assert.doesNotContain(a, b, "a中不能含有b");
}
@Test
public void hasText() throws Exception {
Assert.hasText(" ", "不能为null或空格!");
}
}