Looly 5 年之前
父节点
当前提交
bab6ab5a27
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      hutool-core/src/test/java/cn/hutool/core/lang/SnowflakeTest.java

+ 9 - 0
hutool-core/src/test/java/cn/hutool/core/lang/SnowflakeTest.java

@@ -5,6 +5,7 @@ import cn.hutool.core.exceptions.UtilException;
 import cn.hutool.core.thread.ConcurrencyTester;
 import cn.hutool.core.thread.ThreadUtil;
 import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
 import org.junit.Assert;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -66,4 +67,12 @@ public class SnowflakeTest {
 			}
 		});
 	}
+
+	@Test
+	public void getSnowflakeLengthTest(){
+		for (int i = 0; i < 1000; i++) {
+			final long l = IdUtil.getSnowflake(0, 0).nextId();
+			Assert.assertEquals(19, StrUtil.toString(l).length());
+		}
+	}
 }