public class Air21QueryMileStoneJobTest{
@InjectMocks
Air21QueryMileStoneJob air21QueryMileStoneJob ;
@InjectMocks
Air21OrderStatusHandler air21OrderStatusHandler;
@org.mockito.Mock
private LocationDAO locationDAO;
@Before
public void setup() {
locationDAO= new LocationDAO();
air21OrderStatusHandler = new Air21OrderStatusHandler();
air21OrderStatusHandler.setLocationDAO(locationDAO); /*Map<String, String> criteriaMap = new HashMap<String, String>();
criteriaMap.put("location", "AA");
Mockito.when(locationDAO.query(criteriaMap)).thenReturn("GTM+8");*/
MockitoAnnotations.initMocks(this);
} @Test
public void testQueryActionDateTzName() throws Exception { Map<String, String> criteriaMap = new HashMap<String, String>();
criteriaMap.put("location", "AA");
ArrayList<LocationDO> arrayList = new ArrayList<LocationDO>();
LocationDO locationDO = new LocationDO();locationDO.setTimezone("AAAA");
arrayList.add(locationDO);
Mockito.when(locationDAO.query(criteriaMap)).thenReturn(arrayList); // Air21OrderStatusHandler air21OrderStatusHandler = new Air21OrderStatusHandler();
String queryActionDateTz = air21OrderStatusHandler.queryActionDateTz("AA");
System.out.println(queryActionDateTz);
}

元代码:

public class Air21OrderStatusHandler {
/********************************
* 1.convert bean step1 get comment data step2 loop scan_details step3 convert
* data to order_status step4 collect order_status
*
* 2.if status is DDL or DL1 ,update edi_history isOverMileStone="true"
*
* 3.delete old milestone info
*
* 4.save new milestone to orderstatus table
***************************************/
@Autowired
private LocationDAO locationDAO; public String queryActionDateTz(String postLocation) {
LOGGER.info("start get timezone by location");
String fTimeZone = "";
Map<String, String> criteriaMap = new HashMap<String, String>();
criteriaMap.put("location", postLocation);
@SuppressWarnings("unchecked")
List<LocationDO> locationDOlist = (List<LocationDO>) locationDAO.query(criteriaMap);
if (!locationDOlist.isEmpty() && locationDOlist.size() > ) {
fTimeZone = locationDOlist.get().getTimezone();
} else {
fTimeZone = MilestoneConstant.TIME_ZONE;
}
LOGGER.info("end get timezone by location");
LOGGER.info("TimeZone is :{}", fTimeZone);
return fTimeZone;
}

最新文章

  1. JS判断网页是否在微信中打开/
  2. 项目中如何GB2312转UTF-8
  3. EF架构~DefaultValue让我的UnitOfWork更可读
  4. 聊一下C#开发者如何过渡到JAVA 开发者
  5. 添加事件及Event对象的兼容写法
  6. 关于Windows下的文件后缀名问题
  7. 简单的计算最值的MapReduce程序
  8. Python 基础语法(三)
  9. 初识 Asp.Net内置对象之Session对象
  10. chkconfig用法
  11. poj 3304(直线与线段相交)
  12. ubuntu server 12.04 源
  13. Windwos下 php mysql apache 环境配置
  14. Fliptile 翻格子游戏
  15. MTK如何烧录IMEI码(俗称串号)
  16. vue.js 列表追加项写法
  17. hdu6396(思维+输入挂)
  18. 微信小程序-转发
  19. 洗礼灵魂,修炼python(28)--异常处理(2)—&gt;运用异常
  20. Quantum Computation and Quantum Information

热门文章

  1. Android------个人项目(歆语气象通)
  2. 最短路径求解(Dijkstra)
  3. bzoj1143: [CTSC2008]祭祀river 最长反链
  4. LTE空口协议——是空口3GPP协议 不是网络IP协议
  5. 【hive】求日期是星期几
  6. SPOJ COMPANYS Two Famous Companies 最小生成树,二分,思路 难度:2
  7. 网络编程I/O函数介绍
  8. Shell 命令行,写一个自动整理 ~/Downloads/ 文件夹下文件的脚本
  9. “之”字形输出二叉树 python
  10. angularJS指令动态加载template