mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add methods
This commit is contained in:
@@ -21,4 +21,22 @@ public class BooleanUtilTest {
|
||||
Assert.assertFalse(BooleanUtil.toBoolean("6455434"));
|
||||
Assert.assertFalse(BooleanUtil.toBoolean(""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void andTest(){
|
||||
Assert.assertFalse(BooleanUtil.and(true,false));
|
||||
Assert.assertFalse(BooleanUtil.andOfWrap(true,false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void orTest(){
|
||||
Assert.assertTrue(BooleanUtil.or(true,false));
|
||||
Assert.assertTrue(BooleanUtil.orOfWrap(true,false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void xorTest(){
|
||||
Assert.assertTrue(BooleanUtil.xor(true,false));
|
||||
Assert.assertTrue(BooleanUtil.xorOfWrap(true,false));
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,13 @@
|
||||
package cn.hutool.core.util;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TypeUtilTest {
|
||||
|
||||
@Test
|
||||
@@ -39,4 +39,21 @@ public class TypeUtilTest {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTypeArgumentTest(){
|
||||
// 测试不继承父类,而是实现泛型接口时是否可以获取成功。
|
||||
final Type typeArgument = TypeUtil.getTypeArgument(IPService.class);
|
||||
Assert.assertEquals(String.class, typeArgument);
|
||||
}
|
||||
|
||||
public interface OperateService<T> {
|
||||
void service(T t);
|
||||
}
|
||||
|
||||
public static class IPService implements OperateService<String> {
|
||||
@Override
|
||||
public void service(String string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user