forked from fanruan/finekit
richie
5 years ago
5 changed files with 23 additions and 23 deletions
@ -1,6 +1,6 @@ |
|||||||
package com.fanruan.api.util; |
package com.fanruan.api.util; |
||||||
|
|
||||||
public class ReflectKit { |
public class TypeKit { |
||||||
|
|
||||||
/** |
/** |
||||||
* 判读指定的类是否是另一个类的子类 |
* 判读指定的类是否是另一个类的子类 |
@ -1,19 +0,0 @@ |
|||||||
package com.fanruan.api.util; |
|
||||||
|
|
||||||
import org.junit.Assert; |
|
||||||
import org.junit.Test; |
|
||||||
|
|
||||||
public class ReflectKitTest { |
|
||||||
|
|
||||||
@Test |
|
||||||
public void classInstanceOf() { |
|
||||||
Assert.assertTrue(ReflectKit.classInstanceOf(Integer.class, Object.class)); |
|
||||||
Assert.assertFalse(ReflectKit.classInstanceOf(Object.class, Integer.class)); |
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void objectInstanceOf() { |
|
||||||
Assert.assertTrue(ReflectKit.objectInstanceOf(1, Integer.class)); |
|
||||||
Assert.assertFalse(ReflectKit.objectInstanceOf(1.0, Integer.class)); |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,19 @@ |
|||||||
|
package com.fanruan.api.util; |
||||||
|
|
||||||
|
import org.junit.Assert; |
||||||
|
import org.junit.Test; |
||||||
|
|
||||||
|
public class TypeKitTest { |
||||||
|
|
||||||
|
@Test |
||||||
|
public void classInstanceOf() { |
||||||
|
Assert.assertTrue(TypeKit.classInstanceOf(Integer.class, Object.class)); |
||||||
|
Assert.assertFalse(TypeKit.classInstanceOf(Object.class, Integer.class)); |
||||||
|
} |
||||||
|
|
||||||
|
@Test |
||||||
|
public void objectInstanceOf() { |
||||||
|
Assert.assertTrue(TypeKit.objectInstanceOf(1, Integer.class)); |
||||||
|
Assert.assertFalse(TypeKit.objectInstanceOf(1.0, Integer.class)); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue