private boolean isValuePartOfPhoneNumberList(List<PhoneNumber> list, String value) { if (list != null) { for (PhoneNumber actAttribute : list) { if (actAttribute.getValue().equals(value)) { return true; } } } return false; }
public void testSetViaPositionInListXPath() { Customer customer = new Customer(); PhoneNumber pn1 = new PhoneNumber(); customer.getPhoneNumbers().add(pn1); PhoneNumber pn2 = new PhoneNumber(); customer.getPhoneNumbers().add(pn2); xmlContext.setValueByXPath( customer, "contact-info/phone-number[2]/text()", null, CONTROL_PHONE_NUMBER_2); assertSame(CONTROL_PHONE_NUMBER_2, pn2.getValue()); }