@Override public void writeAttribute(String name, Object value, String property) throws IOException { currentRecord.addAttribute(new Attribute(name, value, property)); }
@Override public void addAttribute(Attribute attr) { if(getChildren().size()>0){ throw new FacesTestException("Attempt to write attribute after element content"); } if(attributes.containsKey(attr.getName())){ throw new FacesTestException("Element alresdy has attribute"); } attributes.put(attr.getName(),attr); }
@Override public String toString() { StringBuilder text = new StringBuilder(); text.append("<").append(name); if(attributes.size()>0){ for (Attribute attr : attributes.values()) { text.append(" ").append(attr.toString()); } } String content = super.toString(); if(content.length()>0){ text.append(">").append(content); text.append("</").append(name).append(">"); } else { text.append("/>"); } return text.toString(); }
.containsAttribute(attribute)) && (null == attributePattern || attributePattern.matcher(element .getAttribute(attribute).getValue().toString()).matches()) && (null == contentPattern || contentPattern.matcher(element.getText()).matches())) { result.add(element);
.containsAttribute(attribute)) && (null == attributePattern || attributePattern.matcher(element .getAttribute(attribute).getValue().toString()).matches()) && (null == contentPattern || contentPattern.matcher(element.getText()).matches())) { result.add(element);
public Object getAttribute(String name) throws NotFoundException { ElementRecord elementRecord = lookupSingleElement(); if (elementRecord.containsAttribute(name)) { return elementRecord.getAttribute(name).getValue(); } else { throw new NotFoundException("Element " + elementRecord.getName() + " has no attribute " + name); } }
@Override public void writeAttribute(String name, Object value, String property) throws IOException { currentRecord.addAttribute(new Attribute(name, value, property)); }
@Override public void addAttribute(Attribute attr) { if(getChildren().size()>0){ throw new FacesTestException("Attempt to write attribute after element content"); } if(attributes.containsKey(attr.getName())){ throw new FacesTestException("Element alresdy has attribute"); } attributes.put(attr.getName(),attr); }
@Override public String toString() { StringBuilder text = new StringBuilder(); text.append("<").append(name); if(attributes.size()>0){ for (Attribute attr : attributes.values()) { text.append(" ").append(attr.toString()); } } String content = super.toString(); if(content.length()>0){ text.append(">").append(content); text.append("</").append(name).append(">"); } else { text.append("/>"); } return text.toString(); }
public Object getAttribute(String name) throws NotFoundException { ElementRecord elementRecord = lookupSingleElement(); if (elementRecord.containsAttribute(name)) { return elementRecord.getAttribute(name).getValue(); } else { throw new NotFoundException("Element " + elementRecord.getName() + " has no attribute " + name); } }