mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -11,7 +11,6 @@ import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.time.temporal.TemporalAccessor;
|
||||
import java.util.Date;
|
||||
|
||||
public class LocalDateTimeUtilTest {
|
||||
|
||||
|
@@ -11,7 +11,7 @@ import cn.hutool.core.lang.Console;
|
||||
|
||||
/**
|
||||
* 文件监听单元测试
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
*
|
||||
*/
|
||||
@@ -43,12 +43,12 @@ public class WatchMonitorTest {
|
||||
Console.log("Overflow:{}-> {}", currentPath, obj);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
WatchMonitor monitor = WatchMonitor.createAll("d:/test/aaa.txt", new DelayWatcher(watcher, 500));
|
||||
|
||||
|
||||
monitor.setMaxDepth(0);
|
||||
monitor.start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -3,30 +3,30 @@ package cn.hutool.core.lang;
|
||||
import org.junit.Test;
|
||||
|
||||
public class AssertTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void isNullTest(){
|
||||
String a = null;
|
||||
cn.hutool.core.lang.Assert.isNull(a);
|
||||
Assert.isNull(a);
|
||||
}
|
||||
@Test
|
||||
public void notNullTest(){
|
||||
String a = null;
|
||||
cn.hutool.core.lang.Assert.isNull(a);
|
||||
Assert.isNull(a);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void isTrueTest() {
|
||||
int i = 0;
|
||||
//noinspection ConstantConditions
|
||||
cn.hutool.core.lang.Assert.isTrue(i > 0, IllegalArgumentException::new);
|
||||
Assert.isTrue(i > 0, IllegalArgumentException::new);
|
||||
}
|
||||
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void isTrueTest2() {
|
||||
int i = -1;
|
||||
//noinspection ConstantConditions
|
||||
cn.hutool.core.lang.Assert.isTrue(i >= 0, IndexOutOfBoundsException::new);
|
||||
Assert.isTrue(i >= 0, IndexOutOfBoundsException::new);
|
||||
}
|
||||
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
|
@@ -8,12 +8,12 @@ import org.junit.Test;
|
||||
|
||||
/**
|
||||
* ObjectId单元测试
|
||||
*
|
||||
*
|
||||
* @author looly
|
||||
*
|
||||
*/
|
||||
public class ObjectIdTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void distinctTest() {
|
||||
//生成10000个id测试是否重复
|
||||
@@ -21,10 +21,10 @@ public class ObjectIdTest {
|
||||
for(int i = 0; i < 10000; i++) {
|
||||
set.add(ObjectId.next());
|
||||
}
|
||||
|
||||
|
||||
Assert.assertEquals(10000, set.size());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void nextTest() {
|
||||
|
@@ -3,7 +3,7 @@ package cn.hutool.core.lang;
|
||||
import cn.hutool.core.collection.ConcurrentHashSet;
|
||||
import cn.hutool.core.exceptions.UtilException;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.lang.id.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package cn.hutool.core.lang;
|
||||
|
||||
import cn.hutool.core.collection.ConcurrentHashSet;
|
||||
import cn.hutool.core.lang.id.UUID;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package cn.hutool.core.lang;
|
||||
|
||||
import cn.hutool.core.exceptions.ValidateException;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.lang.id.IdUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@@ -9,25 +9,25 @@ import org.junit.Test;
|
||||
*
|
||||
*/
|
||||
public class CallerTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void getCallerTest() {
|
||||
Class<?> caller = CallerUtil.getCaller();
|
||||
Assert.assertEquals(this.getClass(), caller);
|
||||
|
||||
|
||||
Class<?> caller0 = CallerUtil.getCaller(0);
|
||||
Assert.assertEquals(CallerUtil.class, caller0);
|
||||
|
||||
|
||||
Class<?> caller1 = CallerUtil.getCaller(1);
|
||||
Assert.assertEquals(this.getClass(), caller1);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getCallerCallerTest() {
|
||||
Class<?> callerCaller = CallerTestClass.getCaller();
|
||||
Assert.assertEquals(this.getClass(), callerCaller);
|
||||
}
|
||||
|
||||
|
||||
private static class CallerTestClass{
|
||||
public static Class<?> getCaller(){
|
||||
return CallerUtil.getCallerCaller();
|
||||
|
@@ -13,4 +13,4 @@ public class CallerUtilTest {
|
||||
final String fullCallerMethodName = CallerUtil.getCallerMethodName(true);
|
||||
Assert.assertEquals("cn.hutool.core.lang.caller.CallerUtilTest.getCallerMethodNameTest", fullCallerMethodName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ public class TreeSearchTest {
|
||||
|
||||
@Test
|
||||
public void searchNode() {
|
||||
List<Tree<Long>> treeItems=TreeUtil.build(all_menu, 0L);
|
||||
List<Tree<Long>> treeItems= TreeUtil.build(all_menu, 0L);
|
||||
|
||||
Tree<Long> tree=treeItems.get(0);
|
||||
Tree<Long> searchResult=tree.getNode(3L);
|
||||
|
@@ -14,22 +14,22 @@ import cn.hutool.core.lang.Console;
|
||||
*
|
||||
*/
|
||||
public class ArrangementTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void arrangementTest() {
|
||||
long result = Arrangement.count(4, 2);
|
||||
Assert.assertEquals(12, result);
|
||||
|
||||
|
||||
result = Arrangement.count(4, 1);
|
||||
Assert.assertEquals(4, result);
|
||||
|
||||
|
||||
result = Arrangement.count(4, 0);
|
||||
Assert.assertEquals(1, result);
|
||||
|
||||
|
||||
long resultAll = Arrangement.countAll(4);
|
||||
Assert.assertEquals(64, resultAll);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void selectTest() {
|
||||
Arrangement arrangement = new Arrangement(new String[] { "1", "2", "3", "4" });
|
||||
@@ -47,14 +47,14 @@ public class ArrangementTest {
|
||||
Assert.assertArrayEquals(new String[] {"4", "1"}, list.get(9));
|
||||
Assert.assertArrayEquals(new String[] {"4", "2"}, list.get(10));
|
||||
Assert.assertArrayEquals(new String[] {"4", "3"}, list.get(11));
|
||||
|
||||
|
||||
List<String[]> selectAll = arrangement.selectAll();
|
||||
Assert.assertEquals(Arrangement.countAll(4), selectAll.size());
|
||||
|
||||
|
||||
List<String[]> list2 = arrangement.select(0);
|
||||
Assert.assertEquals(1, list2.size());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void selectTest2() {
|
||||
|
@@ -6,6 +6,7 @@ import cn.hutool.core.date.TimeInterval;
|
||||
import cn.hutool.core.exceptions.UtilException;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.lang.id.IdUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
|
@@ -21,4 +21,4 @@ public class A {
|
||||
t.print();
|
||||
}};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user