add method

This commit is contained in:
Looly
2021-11-05 00:54:30 +08:00
parent 9c6339a99c
commit fa4f71a112
5 changed files with 38 additions and 10 deletions

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
/**
@@ -66,4 +67,13 @@ public class TreeTest {
Assert.assertEquals(treeNodes.size(), 2);
}
@Test
public void walkTest(){
List<String> ids = new ArrayList<>();
final Tree<String> tree = TreeUtil.buildSingle(nodeList, "0");
tree.walk((tr)-> ids.add(tr.getId()));
Assert .assertEquals(7, ids.size());
}
}