web_backend_develope
chenlw 9 years ago
parent 454b0cdd29
commit bc310b9432

@ -1,8 +1,10 @@
package com.platform.test;
import java.lang.reflect.Field;
import org.junit.Test;
import com.platform.entities.MyFilesEntity;
import com.platform.entities.SqlFileInfoEntity;
import com.platform.entities.PreDataInfo;
import com.platform.utils.BeanCopy;
@ -16,7 +18,7 @@ public class BeanCopyTest {
preDataInfo.setDistrictName("setDistrictName");
preDataInfo.setSysCode(4);
preDataInfo.setSysName("sysName");
MyFilesEntity myfile = new MyFilesEntity();
SqlFileInfoEntity myfile = new SqlFileInfoEntity();
BeanCopy.copyBean(preDataInfo, myfile, "id");
System.out.println(myfile.getSysName());
@ -72,5 +74,17 @@ public class BeanCopyTest {
}
return String.valueOf(result);
}
@Test
public void testFiels() {
PreDataInfo pre = new PreDataInfo();
Field[] f = pre.getClass().getDeclaredFields();
for (int i = 0; i < f.length; i++) {
Field tm = f[i];
tm.setAccessible(true);
System.out.println(tm.getGenericType().toString());
}
}
}

@ -0,0 +1,41 @@
package com.platform.test;
import java.util.Date;
import org.junit.Test;
public class StringIntegerTest {
@Test
public void testString2Int() {
String a = "0";
String a1 = "1";
int r = 0;
Date f = new Date();
int b = Integer.valueOf(a);
int b1 = Integer.valueOf(a1);
for (int i = 0; i < 1000000; i++) {
r = b & b1;
}
System.out.println(r);
System.out.println("1: "+(new Date().getTime() - f.getTime()));
String c = "1";
Date f3 = new Date();
String d = "";
for (int i = 0; i < 1000000; i++) {
if (a.equals(a1)){
if (a.equals(c)) {
d= "1";
}
}
else {
a = a1;
}
}
System.out.println(d);
System.out.println("2: "+(new Date().getTime() - f3.getTime()));
}
}

@ -1,6 +1,11 @@
package com.platform.test;
import java.util.Calendar;
import org.junit.Test;
import com.platform.utils.Configs;
import com.platform.utils.DateForm;
import com.platform.utils.FileOperateHelper;
public class TestWriteFile {
@ -12,5 +17,25 @@ public class TestWriteFile {
"Hello! \r\n");
System.out.println("Hello!");
}
@Test
public void TestCalendar(){
Calendar c2 = Calendar.getInstance();
String time = DateForm.date2StringByDay(c2.getTime());
System.out.println(time);
System.out.println("----"+c2.get(Calendar.MONTH));
c2.set(Calendar.MONTH, getMonBeforeHalfYear(c2.get(Calendar.MONTH)));
time = DateForm.date2StringByDay(c2.getTime());
System.out.println(time);
System.out.println("----"+c2.get(Calendar.MONTH));
}
private int getMonBeforeHalfYear(int num){
num -= 6;
if (num <= 0) {
num = num + 12;
}
return num;
}
}

Loading…
Cancel
Save