Assert(断言)
String str=null; Assert.hasText(str,"str is null"); System.out.printIn(str);
断言机制会在第二行校验中如果失败会直接抛出异常中断,
网上说法是断言机制是默认关闭的,开启需在run环境设置 "-ea" 关闭则是 “-da” ,“-ea”后可以跟包名,如“-ea:com.test” 对com.test包起效
String str=null; Assert.hasText(str,"str is null"); System.out.printIn(str);
断言机制会在第二行校验中如果失败会直接抛出异常中断,
网上说法是断言机制是默认关闭的,开启需在run环境设置 "-ea" 关闭则是 “-da” ,“-ea”后可以跟包名,如“-ea:com.test” 对com.test包起效