mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add test
This commit is contained in:
@@ -123,8 +123,18 @@ public class ObjUtilTest {
|
||||
|
||||
Assert.assertSame(val1, ObjUtil.defaultIfNull(val1, Function.identity(), val2));
|
||||
Assert.assertSame(val2, ObjUtil.defaultIfNull(null, Function.identity(), val2));
|
||||
|
||||
SerializableBean obj = new SerializableBean(null);
|
||||
SerializableBean objNull = null;
|
||||
String result3 = ObjUtil.defaultIfNull(obj, Object::toString, "fail");
|
||||
Assert.assertNotNull(result3);
|
||||
|
||||
String result4 = ObjUtil.defaultIfNull(objNull, Object::toString, () -> "fail");
|
||||
Assert.assertNotNull(result4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void cloneTest() {
|
||||
Assert.assertNull(ObjUtil.clone(null));
|
||||
|
Reference in New Issue
Block a user