规范Test中POJO的使用;

This commit is contained in:
emptypoint 2022-09-18 20:04:46 +08:00
parent aba35cc6c2
commit 9417bbee2e

View File

@ -2,6 +2,7 @@ package cn.hutool.core.stream;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.BooleanUtil;
import lombok.Data;
import lombok.experimental.Tolerate;
import org.junit.Assert;
@ -476,7 +477,7 @@ public class EasyStreamTest {
Student.builder().id(8L).name("jobob").parentId(5L).build()
)
// just 4 lambda ,top by condition
.toTree(Student::getId, Student::getParentId, Student::setChildren, Student::isMatchParent);
.toTree(Student::getId, Student::getParentId, Student::setChildren, Student::getMatchParent);
Assert.assertEquals(asList(
Student.builder().id(1L).name("dromara").matchParent(true)
.children(asList(Student.builder().id(3L).name("hutool").parentId(1L)
@ -540,12 +541,16 @@ public class EasyStreamTest {
private Long id;
private Long parentId;
private List<Student> children;
private boolean matchParent;
private Boolean matchParent;
@Tolerate
public Student() {
// this is an accessible parameterless constructor.
}
public Boolean getMatchParent() {
return BooleanUtil.isTrue(matchParent);
}
}
@Test