recheck icon indicating copy to clipboard operation
recheck copied to clipboard

Default values aren't filtered when already persisted

Open beatngu13 opened this issue 6 years ago • 0 comments

Taken from AttributesDifferenceFinder:

private AttributeDifference differenceFor( final IdentifyingAttributes identAttributes, final Serializable expected,
		final Serializable actual, final String key ) {
	if ( expected == null ) {
		return null;
	}
	if ( RecheckIgnore.getInstance().shouldIgnoreAttribute( identAttributes, key ) ) {
		return null;
	}
	// FIXME If default is persisted, then this is true and the default isn't removed.
	if ( Objects.equals( expected, actual ) ) {
		return null;
	}
	// FIXME If default is persisted, then this should yield a AttributeDifference that removes it.
	if ( defaultValueFinder.isDefaultValue( identAttributes, key, actual ) ) {
		return null;
	}
	if ( key.equals( Attributes.SCREENSHOT ) ) {
		final Screenshot expectedScreenshot = (Screenshot) expected;
		final Screenshot actualScreenshot = (Screenshot) actual;
		final ImageDifference imgDiff = imgDiffCalc.compare( expectedScreenshot, actualScreenshot );
		if ( imgDiff.isEqual() ) {
			return null;
		} else {
			return new ScreenshotAttributeDifference( expectedScreenshot, actualScreenshot,
					imgDiff.getStrategyName(), imgDiff.getMatch() );
		}
	}
	return new AttributeDifference( key, expected, actual );
}

beatngu13 avatar Feb 11 '19 15:02 beatngu13