Assert.hasText()

本文介绍了Assert.hasText()方法的使用方式及源码细节,该方法用于验证字符串是否非空且不为空白。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Assert.hasText()方法的用法,我们看源码可以知道
public static void hasText(java.lang.String text);
0 aload_0 [text]
[b] 1 ldc <String "[Assertion failed] - this String argument must have text; it must not be null, empty, or blank"> [58][/b]
3 invokestatic org.springframework.util.Assert.hasText(java.lang.String, java.lang.String) : void [60]
6 return
Line numbers:
[pc: 0, line: 174]
[pc: 6, line: 176]
Local variable table:
[pc: 0, pc: 7] local: text index: 0 type: java.lang.String

一条我们可以看到这个方法可以进行非空验证
java.lang.AssertionError: on-device tests failed: com.google.android.gts.location.gnss.GnssSatelliteBlocklistTest#testBlocklistAllConstellationsButGPS: junit.framework.AssertionFailedError: Failing tests are: (Test: FAIL) Must receive enough GnssStatus changes in time. If failed, possibly, the test has been run deep indoors. Consider retrying test outdoors. at junit.framework.Assert.fail(Assert.java:50) at com.google.android.gts.location.gnss.SoftAssert.assertAll(SoftAssert.java:128) at com.google.android.gts.location.gnss.GnssSatelliteBlocklistTest.blocklistSatellitesAndVerify(GnssSatelliteBlocklistTest.java:110) at com.google.android.gts.location.gnss.GnssSatelliteBlocklistTest.testBlocklistAllConstellationsButGPS(GnssSatelliteBlocklistTest.java:62) com.google.android.gts.location.gnss.GnssSatelliteBlocklistTest#testBlocklistSomeGalileoSatellites: junit.framework.AssertionFailedError: Failing tests are: (Test: FAIL) Must receive enough GnssStatus changes in time. If failed, possibly, the test has been run deep indoors. Consider retrying test outdoors. at junit.framework.Assert.fail(Assert.java:50) at com.google.android.gts.location.gnss.SoftAssert.assertAll(SoftAssert.java:128) at com.google.android.gts.location.gnss.GnssSatelliteBlocklistTest.blocklistSatellitesAndVerify(GnssSatelliteBlocklistTest.java:110) at com.google.android.gts.location.gnss.GnssSatelliteBlocklistTest.testBlocklistSomeGalileoSatellites(GnssSatelliteBlocklistTest.java:76) com.google.android.gts.location.gnss.GnssSatelliteBlocklistTest#testBlocklistSomeGlonassSatellites: junit.framework.AssertionFailedError: Failing tests are: (Test: FAIL) Must receive enough GnssStatus changes in time. If failed, possibly, the test has been run deep indoors. Consider retrying test outdoors. at junit.framework.Assert.fail(Assert.java:50) at com.google.android.gts.location.gnss.SoftAssert.assertAll(SoftAssert.java:128) at com.google.android.gts.location.gnss.GnssSatelliteBlocklistTest.blocklistSatellitesAndVerify(GnssSatelliteBlocklistTest.java:110) at com.google.android.gts.location.gnss.GnssSatelliteBlocklistTest.testBlocklistSomeGlonassSatellites(GnssSatelliteBlocklistTest.java:69)
最新发布
03-27
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值