Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaloyan-raev/6191859 to your computer and use it in GitHub Desktop.
Save kaloyan-raev/6191859 to your computer and use it in GitHub Desktop.
public class IgnoreVariableAttributesDifferenceListener implements
DifferenceListener {
private static final List<String> IGNORE_ATTRS = Arrays
.asList(new String[] { "version", "download-size", "install-size" });
@Override
public int differenceFound(Difference difference) {
if (isIgnoredAttributeDifference(difference)) {
return RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR;
} else {
return RETURN_ACCEPT_DIFFERENCE;
}
}
@Override
public void skippedComparison(Node control, Node test) {
// nothing to do
}
private boolean isIgnoredAttributeDifference(Difference difference) {
return difference.getId() == DifferenceConstants.ATTR_VALUE_ID
&& IGNORE_ATTRS.contains(difference.getControlNodeDetail()
.getNode().getNodeName());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment