|
|
@ -4,17 +4,16 @@ import java.io.File; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Locale; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.easyexcel.test.util.TestFileUtil; |
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.Assert; |
|
|
|
import org.junit.Assert; |
|
|
|
import org.junit.BeforeClass; |
|
|
|
import org.junit.BeforeClass; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.Test; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.easyexcel.test.util.TestFileUtil; |
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* |
|
|
|
|
|
|
|
* @author Jiaju Zhuang |
|
|
|
* @author Jiaju Zhuang |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class DateFormatTest { |
|
|
|
public class DateFormatTest { |
|
|
@ -44,6 +43,14 @@ public class DateFormatTest { |
|
|
|
private void readCn(File file) { |
|
|
|
private void readCn(File file) { |
|
|
|
List<DateFormatData> list = |
|
|
|
List<DateFormatData> list = |
|
|
|
EasyExcel.read(file, DateFormatData.class, null).locale(Locale.CHINA).sheet().doReadSync(); |
|
|
|
EasyExcel.read(file, DateFormatData.class, null).locale(Locale.CHINA).sheet().doReadSync(); |
|
|
|
|
|
|
|
for (DateFormatData data : list) { |
|
|
|
|
|
|
|
if (data.getDateStringCn() != null && !data.getDateStringCn().equals(data.getDate())) { |
|
|
|
|
|
|
|
LOGGER.info("date:cn:{},{}", data.getDateStringCn(), data.getDate()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (data.getNumberStringCn() != null && !data.getNumberStringCn().equals(data.getNumber())) { |
|
|
|
|
|
|
|
LOGGER.info("number:cn{},{}", data.getNumberStringCn(), data.getNumber()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
for (DateFormatData data : list) { |
|
|
|
for (DateFormatData data : list) { |
|
|
|
Assert.assertEquals(data.getDateStringCn(), data.getDate()); |
|
|
|
Assert.assertEquals(data.getDateStringCn(), data.getDate()); |
|
|
|
Assert.assertEquals(data.getNumberStringCn(), data.getNumber()); |
|
|
|
Assert.assertEquals(data.getNumberStringCn(), data.getNumber()); |
|
|
@ -53,6 +60,14 @@ public class DateFormatTest { |
|
|
|
private void readUs(File file) { |
|
|
|
private void readUs(File file) { |
|
|
|
List<DateFormatData> list = |
|
|
|
List<DateFormatData> list = |
|
|
|
EasyExcel.read(file, DateFormatData.class, null).locale(Locale.US).sheet().doReadSync(); |
|
|
|
EasyExcel.read(file, DateFormatData.class, null).locale(Locale.US).sheet().doReadSync(); |
|
|
|
|
|
|
|
for (DateFormatData data : list) { |
|
|
|
|
|
|
|
if (data.getDateStringUs() != null && !data.getDateStringUs().equals(data.getDate())) { |
|
|
|
|
|
|
|
LOGGER.info("date:us:{},{}", data.getDateStringUs(), data.getDate()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (data.getNumberStringUs() != null && !data.getNumberStringUs().equals(data.getNumber())) { |
|
|
|
|
|
|
|
LOGGER.info("number:us{},{}", data.getNumberStringUs(), data.getNumber()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
for (DateFormatData data : list) { |
|
|
|
for (DateFormatData data : list) { |
|
|
|
Assert.assertEquals(data.getDateStringUs(), data.getDate()); |
|
|
|
Assert.assertEquals(data.getDateStringUs(), data.getDate()); |
|
|
|
Assert.assertEquals(data.getNumberStringUs(), data.getNumber()); |
|
|
|
Assert.assertEquals(data.getNumberStringUs(), data.getNumber()); |
|
|
|