add methods

This commit is contained in:
Looly
2020-03-16 22:04:59 +08:00
parent 2801373c9e
commit 3a579171c1
6 changed files with 102 additions and 24 deletions

View File

@@ -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));
}
}

View File

@@ -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) {
}
}
}