mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -1025,4 +1025,14 @@ public class ArrayUtilTest {
|
||||
final int index = ArrayUtil.matchIndex(value -> value == 3, array);
|
||||
assertEquals(2, index);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testofArrayWithNonEmptyIterable() {
|
||||
// Given
|
||||
final List<String> list = Arrays.asList("a", "b", "c");
|
||||
// When
|
||||
final String[] result = ArrayUtil.ofArray(list, String.class);
|
||||
// Then
|
||||
assertArrayEquals(list.toArray(new String[0]), result, "The array should match the list contents.");
|
||||
}
|
||||
}
|
||||
|
@@ -21,8 +21,17 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class StreamUtilTest {
|
||||
|
||||
@Test
|
||||
void toListTest() {
|
||||
final Set<Object[]> a = SetUtil.of(new Object[]{1, 2}, new Object[]{3, 4});
|
||||
final List<Object> objects = StreamUtil.of(a).collect(Collectors.toList());
|
||||
assertEquals(2, objects.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testIterateHierarchies() {
|
||||
// 创建一个三层的树结构,每个节点都有两个子节点
|
||||
|
Reference in New Issue
Block a user