private String formatAttribute(final Tag tag) { StringBuilder sb = new StringBuilder(); sb.append(tag.getName().getLocalPart()); sb.append(" "); for (Map.Entry<QName, String> attr : tag.getAttributes().entrySet()) { sb.append(attr.getKey()); sb.append("=\""); sb.append(attr.getValue()); sb.append("\" "); } return sb.toString().trim(); }
private String formatAttribute(final Tag tag) { StringBuilder sb = new StringBuilder(); sb.append(tag.getName().getLocalPart()); sb.append(" "); for (Map.Entry<QName, String> attr : tag.getAttributes().entrySet()) { sb.append(attr.getKey()); sb.append("=\""); sb.append(attr.getValue()); sb.append("\" "); } return sb.toString().trim(); }
public int hashCode() { return getName().hashCode() + getAttributes().hashCode(); }
public int hashCode() { return getName().hashCode() + getAttributes().hashCode(); }
public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Tag)) { return false; } if (object == this) { return true; } Tag tag = (Tag) object; if (!getName().equals(tag.getName())) { return false; } for (QName attr : getAttributes().keySet()) { if (getIgnoreAttr().contains(attr.getLocalPart()) || getIgnoreAttr().contains(getName().getLocalPart() + "@" + attr.getLocalPart())) { continue; } if (!tag.getAttributes().containsKey(attr)) { return false; } if (!tag.getAttributes().get(attr).equals(getAttributes().get(attr))) { return false; } } return true; } }
public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Tag)) { return false; } if (object == this) { return true; } Tag tag = (Tag) object; if (!getName().equals(tag.getName())) { return false; } for (QName attr : getAttributes().keySet()) { if (getIgnoreAttr().contains(attr.getLocalPart()) || getIgnoreAttr().contains(getName().getLocalPart() + "@" + attr.getLocalPart())) { continue; } if (!tag.getAttributes().containsKey(attr)) { return false; } if (!tag.getAttributes().get(attr).equals(getAttributes().get(attr))) { return false; } } return true; } }
newTag.getAttributes().put(reader.getAttributeName(i), reader.getAttributeValue(i));
newTag.getAttributes().put(reader.getAttributeName(i), reader.getAttributeValue(i));
sourceTag.getName().toString()); for (Map.Entry<QName, String> attr : expectedTag.getAttributes().entrySet()) { if (ignoreAttr.contains(attr.getKey().getLocalPart())) { continue; if (sourceTag.getAttributes().containsKey(attr.getKey())) { if (!sourceTag.getAttributes().get(attr.getKey()).equals(attr.getValue())) { throw new ComparisonFailure("Attributes not equal: ", attr.getKey() + ":" + attr.getValue(), attr.getKey() + ":" + sourceTag.getAttributes().get(attr.getKey()));
sourceTag.getName().toString()); for (Map.Entry<QName, String> attr : expectedTag.getAttributes().entrySet()) { if (ignoreAttr.contains(attr.getKey().getLocalPart())) { continue; if (sourceTag.getAttributes().containsKey(attr.getKey())) { if (!sourceTag.getAttributes().get(attr.getKey()).equals(attr.getValue())) { throw new ComparisonFailure("Attributes not equal: ", attr.getKey() + ":" + attr.getValue(), attr.getKey() + ":" + sourceTag.getAttributes().get(attr.getKey()));
newTag.getAttributes().put(reader.getAttributeName(i), tp);
newTag.getAttributes().put(reader.getAttributeName(i), tp);
expected.getAttributes(), source.getAttributes(), ignoreAttr); assertAttributesEquals(expected.getName(), source.getAttributes(), expected.getAttributes(), ignoreAttr);
expected.getAttributes(), source.getAttributes(), ignoreAttr); assertAttributesEquals(expected.getName(), source.getAttributes(), expected.getAttributes(), ignoreAttr);