Browse Source

单元测试

master
richie 5 years ago
parent
commit
2227a96f7d
  1. 30
      src/test/java/com/fanruan/api/util/GeneralKitTest.java

30
src/test/java/com/fanruan/api/util/GeneralKitTest.java

@ -1,9 +1,7 @@
package com.fanruan.api.util; package com.fanruan.api.util;
import com.fanruan.api.Prepare; import com.fanruan.api.Prepare;
import com.fr.third.guava.base.Objects;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.third.javax.persistence.criteria.CriteriaBuilder;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -20,26 +18,8 @@ public class GeneralKitTest extends Prepare {
} }
@Test @Test
public void equals() throws Exception{
Integer x = 5;
Integer y = 10;
Integer z =5;
Short a = 5;
Assert.assertEquals(GeneralKit.equals(x, y), false);
Assert.assertEquals(GeneralKit.equals(x, z), true);
Assert.assertEquals(GeneralKit.equals(z, a), false);
}
@Test
public void hashCodes() {
class A {
}
;
Object a = new A();
Assert.assertEquals(GeneralKit.hashCode(a), Objects.hashCode(a));
}
public void objectToString() { public void objectToString() {
Integer s = new Integer(1); Integer s = 1;
Assert.assertEquals(GeneralKit.objectToString(s),"1"); Assert.assertEquals(GeneralKit.objectToString(s),"1");
} }
@ -51,10 +31,10 @@ public class GeneralKitTest extends Prepare {
@Test @Test
public void compare() { public void compare() {
Integer s = new Integer(1); Integer s = 1;
Integer s3 = new Integer(1); Integer s3 = 1;
Integer s1 = new Integer(2); Integer s1 = 2;
Integer s2 = new Integer(0); Integer s2 = 0;
Assert.assertEquals(GeneralKit.compare(s,s1),-1); Assert.assertEquals(GeneralKit.compare(s,s1),-1);
Assert.assertEquals(GeneralKit.compare(s,s3),0); Assert.assertEquals(GeneralKit.compare(s,s3),0);
Assert.assertEquals(GeneralKit.compare(s,s2),1); Assert.assertEquals(GeneralKit.compare(s,s2),1);

Loading…
Cancel
Save