修改文件名称

master
星期八 4 years ago
parent 18eb6e92e3
commit a02199fed2
  1. 68
      panda-aop/src/test/java/org/panda/code/uitl/DateUtilTest.java
  2. 67
      panda-code/src/tests/java/org/panda/code/uitl/DateUtilTest.java
  3. 2
      panda-jdbc/src/main/java/org/panda/jdbc/id/UuIdGenerate.java
  4. 2
      panda-jdbc/src/test/java/org/panda/jdbc/id/IdGenerateTest.java

@ -1,68 +0,0 @@
package org.panda.code.uitl;
import org.junit.Test;
import java.text.ParseException;
import java.util.Date;
/**
* 核心包-日期工具类测试
* @author qi
*
*/
public class DateUtilTest {
/**
* 日期格式化采用默认格式yyyy-MM-dd HH:mm:ss
*/
@Test
public void getDateToStr() {
String dateToStr = DateUtil.getDateToStr(new Date());
System.out.println(dateToStr);
String dateToStr2 = DateUtil.getDateToStr(null);
System.out.println(dateToStr2);
}
/**
*日期格式化
*/
@Test
public void getDateToStr1() {
String dateToStr = DateUtil.getDateToStr(new Date(),"yyyy-MM-dd HH:mm");
System.out.println(dateToStr);
}
/**
* 字符串转日期
*/
@Test
public void strToDate() {
try {
Date date = DateUtil.strToDate("2020-01-20 22:51","yyyy-MM-dd HH:mm");
System.out.println(date);
} catch (ParseException e) {
e.printStackTrace();
}
}
@Test
public void disparityDay() {
try {
Date starDate = DateUtil.strToDate("2019-01-22","yyyy-MM-dd");
Date endDate = DateUtil.strToDate("2019-02-24","yyyy-MM-dd");
System.out.println(endDate);
int day = DateUtil.disparityDay(starDate,endDate);
System.out.println(day);
} catch (ParseException e) {
e.printStackTrace();
}
}
@Test
public void dataFormat() {
}
}

@ -1,67 +0,0 @@
package org.panda.code.uitl;
import org.apache.commons.lang3.time.DateUtils;
import org.junit.Test;
import java.text.ParseException;
import java.util.Date;
public class DateUtilTest {
/**
* 日期格式化采用默认格式yyyy-MM-dd HH:mm:ss
*/
@Test
public void getDateToStr() {
String dateToStr = DateUtil.getDateToStr(new Date());
System.out.println(dateToStr);
String dateToStr2 = DateUtil.getDateToStr(null);
System.out.println(dateToStr2);
}
/**
*日期格式化
*/
@Test
public void getDateToStr1() {
String dateToStr = DateUtil.getDateToStr(new Date(),"yyyy-MM-dd HH:mm");
System.out.println(dateToStr);
}
/**
* 字符串转日期
*/
@Test
public void strToDate() {
try {
Date date = DateUtil.strToDate("2020-01-20 22:51","yyyy-MM-dd HH:mm");
System.out.println(date);
} catch (ParseException e) {
e.printStackTrace();
}
}
@Test
public void disparityDay() {
try {
Date starDate = DateUtil.strToDate("2019-01-22","yyyy-MM-dd");
Date endDate = DateUtil.strToDate("2020-02-24","yyyy-MM-dd");
System.out.println((endDate.getTime()-starDate.getTime())/(24*60*60*1000)) ;
System.out.println((24*60*60*1000));
int day = DateUtil.disparityDay(starDate,endDate);
System.out.println(day);
} catch (ParseException e) {
e.printStackTrace();
}
}
@Test
public void dataFormat() {
}
}

@ -6,7 +6,7 @@ import java.util.UUID;
* @Description uuid主键生成 * @Description uuid主键生成
* @Author qi * @Author qi
**/ **/
public class UUIdGenerate implements IdGenerate<String> { public class UuIdGenerate implements IdGenerate<String> {
@Override @Override
public String nextId() { public String nextId() {
return UUID.randomUUID().toString(); return UUID.randomUUID().toString();

@ -6,7 +6,7 @@ public class IdGenerateTest extends TestCase {
public void testNextId() { public void testNextId() {
IdGenerate<String> stringIdGenerate = new UUIdGenerate(); IdGenerate<String> stringIdGenerate = new UuIdGenerate();
for (int i=0;i<10000;i++){ for (int i=0;i<10000;i++){
System.out.println(stringIdGenerate.nextId()); System.out.println(stringIdGenerate.nextId());
} }

Loading…
Cancel
Save