Last active
December 20, 2015 20:39
-
-
Save kaloyan-raev/6191859 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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