处理BDPB标签体只包含空白换行符导致转换对象报错问题。
添加单元测试程序
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package com.gzzn.omms.msgexchangeapi.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Date;
|
||||
@@ -18,6 +16,7 @@ import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import com.gzzn.omms.msgexchangeapi.dao.CminmsgDao;
|
||||
import com.gzzn.omms.msgexchangeapi.dao.CminmsgTestDao;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.MESSAGESUBTYPES;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.MESSAGETYPES;
|
||||
import com.gzzn.omms.msgexchangeapi.entity.msg.MSG;
|
||||
@@ -38,6 +37,8 @@ public class ExchangeServiceImplTest {
|
||||
@Autowired
|
||||
private CminmsgDao cminmsgDao;
|
||||
|
||||
@Autowired
|
||||
private CminmsgTestDao cminmsgTestDao;
|
||||
|
||||
@Test
|
||||
public void testXmlToJson() throws JsonParseException, JsonMappingException, IOException {
|
||||
@@ -94,27 +95,19 @@ public class ExchangeServiceImplTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testXmlToDNLDMsg() throws JsonParseException, JsonMappingException, IOException
|
||||
public void testXmlToMsg() throws JsonParseException, JsonMappingException, IOException
|
||||
{
|
||||
String xml = cminmsgDao.findOne(300L).getCminmsgsClobMsg();
|
||||
String xml = cminmsgTestDao.findOne(847328L).getCminmsgsClobMsg();//847325L
|
||||
MSG msg = exchangeService.xmlToMsg(xml);
|
||||
|
||||
MSG dNLDMsg = exchangeService.xmlToMsg(xml);
|
||||
String jsonString=JsonUtil.getString(dNLDMsg);
|
||||
|
||||
File file = new File("schd.json");
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
fos.write(jsonString.getBytes("utf-8"));
|
||||
fos.close();
|
||||
|
||||
|
||||
System.out.println(jsonString);
|
||||
System.out.println(JsonUtil.getStringWithNoneKey(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* POJO 转xml字符串
|
||||
*/
|
||||
@Test
|
||||
public void testObjectToXmlstr()
|
||||
public void testMsgToXml()
|
||||
{
|
||||
Long nowtime = System.currentTimeMillis();
|
||||
MSG rqfdMsg = new MSGBuilder().
|
||||
|
||||
Reference in New Issue
Block a user