public SupplierDTO createSupplierDTO(SupplierDTO supplierDTO, Long shopId) { supplierDTO.setName("zhangjuntao"); supplierDTO.setShopId(shopId); supplierDTO.setMobile("15862936076"); supplierDTO.setAddress("苏州"); ContactDTO[] contactDTOs = new ContactDTO[3]; ContactDTO contactDTO = new ContactDTO(); contactDTO.setMobile(supplierDTO.getMobile()); contactDTO.setIsMainContact(1); contactDTO.setDisabled(1); contactDTOs[0] = contactDTO; supplierDTO.setContacts(contactDTOs); return supplierDTO; }
@Test public void testUpdateSupplierMobile() throws Exception { ModelMap model = new ModelMap(); Long shopId = createShop(); SupplierDTO supplierDTO = new SupplierDTO(); supplierDTO = createSupplierDTO(supplierDTO, shopId); supplierDTO = userService.createSupplier(supplierDTO); request.getSession().setAttribute("shopId", shopId); request.setParameter("supplierId", supplierDTO.getId().toString()); request.setParameter("mobile", "15851654173"); customerController.updateMobile(request, response); SupplierDTO supplierDTONew = userService.getSupplierById(supplierDTO.getId()); Assert.assertEquals("15851654173", supplierDTONew.getMobile()); }