|
|
@ -21,13 +21,11 @@ import cn.hippo4j.common.toolkit.Assert;
|
|
|
|
import com.github.dozermapper.core.converters.ConversionException;
|
|
|
|
import com.github.dozermapper.core.converters.ConversionException;
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
|
|
|
import com.google.common.collect.Sets;
|
|
|
|
import lombok.*;
|
|
|
|
import lombok.*;
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* BeanUtil Test
|
|
|
|
* BeanUtil Test
|
|
|
@ -75,6 +73,17 @@ public class BeanUtilTest {
|
|
|
|
Assert.isTrue(Objects.equals(list.size(), persons.size()));
|
|
|
|
Assert.isTrue(Objects.equals(list.size(), persons.size()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void SetToSetConvertTest() {
|
|
|
|
|
|
|
|
final Set<Person> sets = Sets.newHashSet();
|
|
|
|
|
|
|
|
sets.add(Person.builder().name("one").age(1).build());
|
|
|
|
|
|
|
|
sets.add(Person.builder().name("two").age(2).build());
|
|
|
|
|
|
|
|
sets.add(Person.builder().name("three").age(3).build());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final Set<PersonVo> persons = BeanUtil.convert(sets, PersonVo.class);
|
|
|
|
|
|
|
|
Assert.isTrue(Objects.equals(sets.size(), persons.size()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void copyPropertiesBeanToMapTest() {
|
|
|
|
public void copyPropertiesBeanToMapTest() {
|
|
|
|
// 测试BeanToMap
|
|
|
|
// 测试BeanToMap
|
|
|
|