mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix WatchMonitor
This commit is contained in:
@@ -164,13 +164,20 @@ public class ArrayUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mapTest() {
|
||||
public void zipTest() {
|
||||
final String[] keys = {"a", "b", "c"};
|
||||
final Integer[] values = {1, 2, 3};
|
||||
final Map<String, Integer> map = ArrayUtil.zip(keys, values, true);
|
||||
Assertions.assertEquals(Objects.requireNonNull(map).toString(), "{a=1, b=2, c=3}");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mapToArrayTest() {
|
||||
final String[] keys = {"a", "b", "c"};
|
||||
final Integer[] integers = ArrayUtil.mapToArray(keys, String::length, Integer[]::new);
|
||||
Assertions.assertArrayEquals(integers, new Integer[]{1, 1, 1});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void castTest() {
|
||||
final Object[] values = {"1", "2", "3"};
|
||||
@@ -453,7 +460,7 @@ public class ArrayUtilTest {
|
||||
final Object a = new int[]{1, 2, 3, 4};
|
||||
final Object[] wrapA = ArrayUtil.wrap(a);
|
||||
for (final Object o : wrapA) {
|
||||
Assertions.assertTrue(o instanceof Integer);
|
||||
Assertions.assertInstanceOf(Integer.class, o);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -15,8 +15,9 @@ package org.dromara.hutool.core.io;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.WatchEvent;
|
||||
|
||||
import org.dromara.hutool.core.io.watch.SimpleWatcher;
|
||||
import org.dromara.hutool.core.io.watch.watchers.SimpleWatcher;
|
||||
import org.dromara.hutool.core.io.watch.WatchMonitor;
|
||||
import org.dromara.hutool.core.io.watch.WatchUtil;
|
||||
import org.dromara.hutool.core.io.watch.Watcher;
|
||||
import org.dromara.hutool.core.io.watch.watchers.DelayWatcher;
|
||||
import org.dromara.hutool.core.lang.Console;
|
||||
@@ -56,7 +57,8 @@ public class WatchMonitorTest {
|
||||
}
|
||||
};
|
||||
|
||||
final WatchMonitor monitor = WatchMonitor.ofAll("d:/test/aaa.txt", new DelayWatcher(watcher, 500));
|
||||
//noinspection resource
|
||||
final WatchMonitor monitor = WatchUtil.ofAll("d:/test/aaa.txt", new DelayWatcher(watcher, 500));
|
||||
|
||||
monitor.setMaxDepth(0);
|
||||
monitor.start();
|
||||
|
Reference in New Issue
Block a user