mirror of
https://gitee.com/dromara/hutool.git
synced 2025-07-31 16:11:50 +08:00
fix test
This commit is contained in:
parent
c14390dd6d
commit
213a65aa0f
@ -3,23 +3,18 @@ package cn.hutool.core.map;
|
||||
import cn.hutool.core.io.SerializeUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class TolerantMapTest {
|
||||
|
||||
private final TolerantMap<String, String> map = TolerantMap.of(new HashMap<>(), "default");
|
||||
|
||||
@BeforeEach
|
||||
public void before() {
|
||||
map.put("monday", "星期一");
|
||||
map.put("tuesday", "星期二");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSerialize() {
|
||||
TolerantMap<String, String> map = TolerantMap.of(new HashMap<>(), "default");
|
||||
map.put("monday", "星期一");
|
||||
map.put("tuesday", "星期二");
|
||||
|
||||
final byte[] bytes = SerializeUtil.serialize(map);
|
||||
final TolerantMap<String, String> serializedMap = SerializeUtil.deserialize(bytes);
|
||||
assert serializedMap != map;
|
||||
@ -28,6 +23,10 @@ public class TolerantMapTest {
|
||||
|
||||
@Test
|
||||
public void testClone() {
|
||||
TolerantMap<String, String> map = TolerantMap.of(new HashMap<>(), "default");
|
||||
map.put("monday", "星期一");
|
||||
map.put("tuesday", "星期二");
|
||||
|
||||
final TolerantMap<String, String> clonedMap = ObjUtil.clone(map);
|
||||
assert clonedMap != map;
|
||||
assert map.equals(clonedMap);
|
||||
@ -35,6 +34,10 @@ public class TolerantMapTest {
|
||||
|
||||
@Test
|
||||
public void testGet() {
|
||||
TolerantMap<String, String> map = TolerantMap.of(new HashMap<>(), "default");
|
||||
map.put("monday", "星期一");
|
||||
map.put("tuesday", "星期二");
|
||||
|
||||
assert "星期二".equals(map.get("tuesday"));
|
||||
assert "default".equals(map.get(RandomUtil.randomString(6)));
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Tolerate;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Comparator;
|
||||
@ -41,7 +40,10 @@ public class BeanTreeTest {
|
||||
List<JavaBean> originJavaBeanTree;
|
||||
BeanTree<JavaBean, Long> beanTree;
|
||||
|
||||
@BeforeEach
|
||||
BeanTreeTest(){
|
||||
setUp();
|
||||
}
|
||||
|
||||
public void setUp() {
|
||||
originJavaBeanList = EasyStream
|
||||
.of(
|
||||
|
Loading…
Reference in New Issue
Block a user