Merge pull request #2071 from wangliang181230/optimize-unit-test

在单元测试中不使用hutool的断言
This commit is contained in:
Golden Looly 2022-01-06 10:59:06 +08:00 committed by GitHub
commit fa3d3afb34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,7 @@
package cn.hutool.core.collection;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.thread.ThreadUtil;
import org.junit.Assert;
import org.junit.Test;
import java.util.Arrays;
@ -27,7 +27,7 @@ public class RingIndexUtilTest {
ThreadUtil.concurrencyTest(strList.size(), () -> {
final int index = RingIndexUtil.ringNextIntByObj(strList, atomicInteger);
final String s = strList.get(index);
Assert.notNull(s);
Assert.assertNotNull(s);
});
}

View File

@ -1,6 +1,6 @@
package cn.hutool.core.thread;
import cn.hutool.core.lang.Assert;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
@ -33,6 +33,6 @@ public class AsyncUtilTest {
// 等待完成
AsyncUtil.waitAll(hutool, sweater, warm);
// 获取结果
Assert.isTrue("hutool卫衣真暖和".equals(AsyncUtil.get(hutool) + AsyncUtil.get(sweater) + AsyncUtil.get(warm)));
Assert.assertEquals("hutool卫衣真暖和", AsyncUtil.get(hutool) + AsyncUtil.get(sweater) + AsyncUtil.get(warm));
}
}

View File

@ -89,9 +89,9 @@ public class StrUtilTest {
Assert.assertEquals("", split.get(2));
}
@Test(expected = IllegalArgumentException.class)
@Test
public void splitNullTest() {
StrUtil.split(null, '.');
Assert.assertEquals(0, StrUtil.split(null, '.').size());
}
@Test(expected = IllegalArgumentException.class)

View File

@ -1,9 +1,9 @@
package cn.hutool.crypto.test;
import cn.hutool.core.lang.Assert;
import cn.hutool.crypto.BCUtil;
import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
import org.junit.Assert;
import org.junit.Test;
public class BCUtilTest {
@ -17,7 +17,7 @@ public class BCUtilTest {
String y = "F7E938B02EED7280277493B8556E5B01CB436E018A562DFDC53342BF41FDF728";
final ECPublicKeyParameters keyParameters = BCUtil.toSm2Params(x, y);
Assert.notNull(keyParameters);
Assert.assertNotNull(keyParameters);
}
@Test
@ -25,6 +25,6 @@ public class BCUtilTest {
String privateKeyHex = "5F6CA5BB044C40ED2355F0372BF72A5B3AE6943712F9FDB7C1FFBAECC06F3829";
final ECPrivateKeyParameters keyParameters = BCUtil.toSm2Params(privateKeyHex);
Assert.notNull(keyParameters);
Assert.assertNotNull(keyParameters);
}
}