@Test(groups = { "createPhone" }, dataProvider = "setupPhone", dataProviderClass = PhoneDataProvider.class, dependsOnGroups = { "readCustomer" }) @Transactional @Rollback(false) public void createPhone(Phone phone) { userName = "customer1"; assert phone.getId() == null; phone = phoneService.savePhone(phone); assert phone.getId() != null; phoneId = phone.getId(); }
@Test(groups = { "readPhoneById" }, dependsOnGroups = { "createPhone" }) public void readPhoneById() { Phone phone = phoneService.readPhoneById(phoneId); assert phone != null; assert phone.getId() == phoneId; } }
phoneNameForm.setPhoneName(cPhone.getPhoneName()); request.setAttribute("customerPhoneId", cPhone.getId()); request.setAttribute("phoneId", cPhone.getPhone().getId());
customerPhone = customerPhoneService.saveCustomerPhone(customerPhone); request.setAttribute("customerPhoneId", customerPhone.getId()); request.setAttribute("phoneId", customerPhone.getPhone().getId());
Collection<Phone> col = c.getPhoneCollection(); Phone original = null; for (Phone phone : col) { if (phone.getId() == p.getId()) { original = phone; break; } } if (original != null) { Phone replacement = new Phone(original); replacement.setNumber(p.getNumber()); replacement.setName(p.getName()); col.remove(original); col.add(replacement); }
public static void main(String[] args) { Customer c = new Customer(); c.addPhone(new Phone(1, "12345", "aaa")); c.addPhone(new Phone(2, "34567", "bbb")); System.out.println(c); Phone p = new Phone(2, "9999999", "new name"); Map<Integer, Phone> phoneMap = c.getPhoneMap(); phoneMap.put(p.getId(), p); System.out.println(c); }
phoneNameForm.setPhoneName(cPhone.getPhoneName()); request.setAttribute("customerPhoneId", cPhone.getId()); request.setAttribute("phoneId", cPhone.getPhone().getId());
customerPhone = customerPhoneService.saveCustomerPhone(customerPhone); request.setAttribute("customerPhoneId", customerPhone.getId()); request.setAttribute("phoneId", customerPhone.getPhone().getId());