public void orderTest3() { Customer customer = customerDAO.getCustomerById(2); List list = orderService.getOrdersByUsername(customer.getUsername()); System.out.println("List size :" + list.size()); for (Object obj : list) { System.out.println(obj); } }
public void orderTest() { Customer customer = customerDAO.getCustomerById(3); List<Commodity> commodityList = commoDAO.getCommoditiesByIdString("2;3;4"); List<OrderCommodityRel> relationLsit = CommodityListTools.commoToRel(commodityList); Order order = new Order(customer, relationLsit, 100); Map<Integer, Integer> map = new HashMap<Integer, Integer>(); map.put(2, 2); map.put(3, 4); map.put(4, 4); order.setBuyNum(map); Date date = new Date(); order.setOrderTime(new Timestamp(date.getTime())); orderDAO.createOrder(order); System.out.println(order.getOrderId()); }
public void testGetCustomerById() { List list = (List) customerDAO.getCustomerById(1); Customer cus = (Customer) list.get(0); assertEquals("赵小明", cus.getUsername()); }